home *** CD-ROM | disk | FTP | other *** search
- /**
- * Scout - The Amiga System Monitor
- *
- *------------------------------------------------------------------
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * You must not use this source code to gain profit of any kind!
- *
- *------------------------------------------------------------------
- *
- * @author Andreas Gelhausen
- * @author Richard Körber <rkoerber@gmx.de>
- */
-
-
-
- #include "scout.h"
- #include <pragmas/identify_pragmas.h>
-
- /*********************************************************************
- Definitionen
- *********************************************************************/
- #define MYLIBVERSION 37
- #define MUIVERSION 8
-
- /*********************************************************************
- Globale Variablen
- *********************************************************************/
- extern struct ExecBase *SysBase;
-
- struct Library *MUIMasterBase;
- struct Library *IdentifyBase;
- struct Library *CxBase;
-
- struct Library *MiscBase;
- struct Library *CiaABase;
- struct Library *CiaBBase;
- struct Library *TimerBase;
-
- struct Task *myprocess;
- struct MsgPort *myarexxport,ScoutPort;
- BOOL ScoutPortAdded = FALSE;
-
- struct IOStdReq InputIORequest;
- BOOL input = TRUE, timer2 = TRUE;
- struct timerequest TimerIORequest;
- BYTE TimerSignal;
-
- BOOL input;
- char *portname;
-
- /*
- ** MUI
- */
-
- APTR AP_Scout;
-
- APTR WI_Main,WI_About;
- APTR WI_Memory,WI_Interrupts,WI_Semaphores;
- APTR WI_InputHandler,WI_Residents,WI_Windows,WI_Expansions;
- APTR WI_Fonts,WI_Vectors,WI_Mount;
- APTR WI_Priority,SL_Priority;
- APTR WI_Signal;
- APTR WI_LowMemory;
- APTR WI_Timer;
- APTR WI_Allocations;
-
- APTR memlist,intlist;
- APTR resilist;
- APTR inputlist;
- APTR lowmemorylist;
- APTR timerlist;
-
- APTR memtext,inttext;
- APTR resitext;
- APTR inputtext;
- APTR lowmemorytext;
- APTR timertext;
- APTR vectext1,vectext2,vectext3,vectext4;
- APTR pritext1,pritext2,pritext3;
- APTR sigtext1,sigtext2,sigtext3,sigtext4;
- APTR alctext1,alctext2,alctext3;
-
- APTR resicount,inputcount,intcount,lowmemorycount,timercount;
- int resicnt,inputcnt,intcnt,lowmemorycnt,timercnt;
-
- APTR intmoretext0,intmoretext1,intmoretext2,intmoretext3;
- APTR resimoretext0,resimoretext1,resimoretext2a,resimoretext2b,resimoretext3;
- APTR memmoretext0,memmoretext1,memmoretext2,memmoretext3,memmorelist;
-
- APTR BT_Ports,BT_Residents,BT_Interrupts,BT_InputHandler,BT_Tasks,BT_Locks;
- APTR BT_Libraries,BT_Devices,BT_Resources,BT_Memory,BT_Windows,BT_Semaphores;
- APTR BT_Assigns,BT_Fonts,BT_Expansions,BT_Vectors,BT_Mount,BT_Commands;
- APTR BT_System,BT_Commodities,BT_Classes,BT_LowMemory,BT_ScreenMode,BT_Allocations,BT_Timer;
-
- APTR BT_AboutContinue;
- APTR BT_MemPrint,BT_MemPriority,BT_MemMore,BT_MemExit;
- APTR BT_IntUpdate,BT_IntPrint,BT_IntRemove,BT_IntMore,BT_IntExit;
- APTR BT_InputUpdate,BT_InputPrint,BT_InputRemove,BT_InputPriority,BT_InputExit;
- APTR BT_ResiUpdate,BT_ResiPrint,BT_ResiMore,BT_ResiExit;
- APTR BT_VecUpdate,BT_VecPrint,BT_VecExit;
- APTR BT_SysPrint,BT_SysExit,BT_SysUpdate;
- APTR BT_PriorityOK,BT_PriorityCancel;
- APTR BT_SignalOK,BT_SignalCancel;
- APTR BT_LowMemoryUpdate,BT_LowMemoryPrint,BT_LowMemoryRemove,BT_LowMemoryPriority,BT_LowMemoryExit;
- APTR BT_LowMemoryCause;
- APTR BT_TimerUpdate,BT_TimerPrint,BT_TimerRemove,BT_TimerExit;
- APTR BT_AlcUpdate,BT_AlcPrint,BT_AlcExit;
-
- APTR AboutText;
-
- APTR liblist_cmphook_ptr;
- APTR devlist_cmphook_ptr;
- APTR reslist_cmphook_ptr;
- APTR tasklist_cmphook_ptr;
- APTR portlist_cmphook_ptr;
- APTR comlist_cmphook_ptr;
- APTR asslist_cmphook_ptr;
- APTR locklist_cmphook_ptr;
- APTR cxlist_cmphook_ptr;
- APTR classlist_cmphook_ptr;
- APTR smodelist_cmphook_ptr;
-
- APTR processorvalue, customvalue;
- APTR processortext, customtext;
-
- #define ID_QUIT MUIV_Application_ReturnID_Quit
-
- struct Remember *MemRememberKey,*IntRememberKey;
- struct Remember *InputRememberKey,*ResiRememberKey;
- struct Remember *GlobalRememberKey,*LowMemoryRememberKey;
- struct Remember *SysRememberKey,*TimerRememberKey;
-
- BPTR printfile, prevdir;
- unsigned char *tmpstr,*tmpstr2;
-
- char *INT_TYPE[] = {
- "TBE (ser.transmit buffer empty)","DSKBLK (disk block complete)",
- "SOFTINT (software interrupt)" ,"PORTS (external INT2 & CIAA)",
- "COPPER (graphics coprocessor)" ,"VERTB (vertical blank interval)",
- "BLITTER (blitter finished)" ,"AUDIO0 (audio channel 0)",
- "AUDIO1 (audio channel 1)" ,"AUDIO2 (audio channel 2)",
- "AUDIO3 (audio channel 3)" ,"RBF (ser. receive buffer full)",
- "DSKSYNC (disk sync patt. found)","EXTER (external INT6 & CIAB)",
- "INTEN (special (master enable))","NMI (non-maskable interrupt)"
- };
-
- char *no_information = "<NO INFORMATION AVAILABLE>";
- char *unknown_productid = "<UNKNOWN PRODUCTID>";
-
- char UpdateText[] = "_Update";
- char RemoveText[] = "_Remove";
- char CloseText[] = "_Close";
- char PriorityText[] = "_Priority";
- char MoreText[] = "_More";
- char ExitText[] = "E_xit";
- char FreezeText[] = "_Freeze";
- char ActivateText[] = "_Activate";
- char SignalText[] = "_Signal";
- char BreakText[] = "_Break";
- char ContinueText[] = "_Continue";
- char CancelText[] = "Cancel";
- char OKText[] = "OK";
- char ReleaseText[] = "Re_lease";
- char ObtainText[] = "_Obtain";
- char PrintText[] = "Pr_int";
- char ToFrontText[] = "To _Front";
- char AppearText[] = "_Appear";
- char DisappearText[] = "_Disappear";
- char EnableText[] = "_Enable";
- char DisableText[] = "Di_sable";
- char KillText[] = "_Kill";
- char ListChgText[] = "List_Chg";
- char UniqueText[] = "U_nique";
- char CauseText[] = "_Cause";
- char FunctionsText[] = "_Functions";
-
- char AllocationsText[] = "Allocations"; /*-*/
- char AssignsText[] = "Assigns";
- char ClassesText[] = "BoopsiClasses"; /*-*/
- char CommoditiesText[] = "Commodities"; /*-*/
- char DevicesText[] = "Devices";
- char CommandsText[] = "Resident Cmds";
- char ExpansionsText[] = "Expansions";
- char FontsText[] = "Fonts";
- char InputHandlersText[]= "InputHandlers";
- char InterruptsText[] = "Interrupts";
- char LibrariesText[] = "Libraries";
- char LocksText[] = "Locks";
- char LowMemoryText[] = "LowMemory"; /*-*/
- char MemoryText[] = "Memory";
- char MountText[] = "Mounted Devs";
- char PortsText[] = "Ports";
- char ResidentsText[] = "Residents";
- char ResourcesText[] = "Resources";
- char ScreenModeText[] = "ScreenMode";
- char SemaphoresText[] = "Semaphores";
- char SystemText[] = "System"; /*-*/
- char TasksText[] = "Tasks";
- char TimerText[] = "Timer"; /*-*/
- char VectorsText[] = "Vectors";
- char WindowsText[] = "Windows";
-
- #define RB CHECKIT
- #define TG CHECKIT|MENUTOGGLE
-
- const struct NewMenu menu_list[] =
- {
- { NM_TITLE, "Project", 0,0,0,0},
- { NM_ITEM, "About...", "?",0,0,(APTR) ID_ABOUT},
- { NM_ITEM, NM_BARLABEL,0,0,0,0},
- { NM_ITEM, "Quit", "Q",0,0,(APTR) ID_QUIT},
-
- { NM_TITLE, "List", 0,0,0,0},
- { NM_ITEM, AllocationsText, "A",0,0,(APTR) ID_ALLOCATIONS},
- { NM_ITEM, AssignsText, "G",0,0,(APTR) ID_ASSIGNS},
- { NM_ITEM, ClassesText, "B",0,0,(APTR) ID_CLASSES},
- { NM_ITEM, CommoditiesText, "K",0,0,(APTR) ID_COMMODITIES},
- { NM_ITEM, DevicesText, "D",0,0,(APTR) ID_DEVICES},
- { NM_ITEM, ExpansionsText, "X",0,0,(APTR) ID_EXPANSIONS},
- { NM_ITEM, FontsText, "F",0,0,(APTR) ID_FONTS},
- { NM_ITEM, InputHandlersText,"H",0,0,(APTR) ID_INPUTHANDLER},
- { NM_ITEM, InterruptsText, "I",0,0,(APTR) ID_INTERRUPTS},
- { NM_ITEM, LibrariesText, "L",0,0,(APTR) ID_LIBRARIES},
- { NM_ITEM, LocksText, "O",0,0,(APTR) ID_LOCKS},
- { NM_ITEM, LowMemoryText, "J",0,0,(APTR) ID_LOWMEMORY},
- { NM_ITEM, MemoryText, "M",0,0,(APTR) ID_MEMORY},
- { NM_ITEM, MountText, "N",0,0,(APTR) ID_MOUNT},
- { NM_ITEM, PortsText, "P",0,0,(APTR) ID_PORTS},
- { NM_ITEM, ResidentsText, "R",0,0,(APTR) ID_RESIDENTS},
- { NM_ITEM, CommandsText, "C",0,0,(APTR) ID_COMMANDS},
- { NM_ITEM, ResourcesText, "U",0,0,(APTR) ID_RESOURCES},
- { NM_ITEM, ScreenModeText, "Z",0,0,(APTR) ID_SCREENMODE},
- { NM_ITEM, SemaphoresText, "S",0,0,(APTR) ID_SEMAPHORES},
- { NM_ITEM, SystemText, "Y",0,0,(APTR) ID_SYSTEM},
- { NM_ITEM, TasksText, "T",0,0,(APTR) ID_TASKS},
- { NM_ITEM, TimerText, "E",0,0,(APTR) ID_TIMER},
- { NM_ITEM, VectorsText, "V",0,0,(APTR) ID_VECTORS},
- { NM_ITEM, WindowsText, "W",0,0,(APTR) ID_WINDOWS},
-
- { NM_TITLE, "Other", 0,0,0,0},
- { NM_ITEM, "Flush devices", 0,0,0,(APTR) ID_FLUSHDEVS},
- { NM_ITEM, "Flush fonts", 0,0,0,(APTR) ID_FLUSHFONTS},
- { NM_ITEM, "Flush libraries",0,0,0,(APTR) ID_FLUSHLIBS},
- { NM_ITEM, "Flush all", ".",0,0,(APTR) ID_FLUSHALL},
- { NM_ITEM, NM_BARLABEL, 0,0,0,0},
- { NM_ITEM, "Clear reset vectors","!",0,0,(APTR) ID_CLEARRESET},
-
- { NM_END, NULL, 0,0,0,0},
- };
-
- /*********************************************************************
- Requester-Daten
- *********************************************************************/
- struct EasyStruct myreqES = {
- sizeof (struct EasyStruct),
- 0,
- "Scout Request",
- NULL,
- NULL,
- };
-
- int MyRequest (char *gadgets, char *fmt, ...) {
- struct Window *myreq_window = NULL;
- int result;
- ULONG iflags = NULL;
- char buf[256];
-
- va_list args;
- va_start(args,fmt);
- vsprintf (buf, fmt, args);
-
- get (WI_Main, MUIA_Window_Window, &myreq_window);
-
- myreqES.es_TextFormat = buf;
- myreqES.es_GadgetFormat = gadgets;
- result = EasyRequest (myreq_window, &myreqES, &iflags);
-
- va_end (args);
- return (result);
- }
-
- char initialdrawer[TEXTLENGTH + 1];
- char initialfile[FILENAMELENGTH + 1] = "prt:";
- UBYTE *printfilename = NULL;
-
- BOOL FileRequest (void) {
- struct Window *aslfr_window = NULL;
- struct FileRequester *requester;
- BOOL result = FALSE;
- char endchar;
-
- get (WI_Main, MUIA_Window_Window, &aslfr_window);
-
- if (aslfr_window) {
- if (requester = AllocAslRequestTags (ASL_FileRequest,
- ASLFR_Window, aslfr_window,
- ASLFR_PrivateIDCMP, TRUE,
- ASLFR_SleepWindow, TRUE,
- NULL)) {
-
- result = AslRequestTags (requester,
- ASLFR_TitleText, "Choose file or printer!",
- ASLFR_InitialDrawer, initialdrawer,
- ASLFR_InitialFile, initialfile,
- ASLFR_DoSaveMode, TRUE,
- NULL);
-
- strncpy (initialdrawer, requester->fr_Drawer, TEXTLENGTH);
- strncpy (initialfile, requester->fr_File, FILENAMELENGTH);
-
- strcpy (printfilename, initialdrawer);
- endchar = printfilename[strlen(printfilename) -1];
-
- if ((strlen(initialdrawer) != 0) && (endchar != '/') && (endchar != ':'))
- strcat (printfilename, "/");
- strcat (printfilename, initialfile);
-
- FreeAslRequest (requester);
- }
- }
- return (result);
- }
-
- BPTR PrintHandle;
- LONG PrintHandleMode = MODE_NEWFILE;
-
- BPTR HandlePrintStart (char *filename) {
- PrintHandle = NULL;
-
- if (AP_Scout) {
- if ((! filename) && (! FileRequest()))
- return (NULL);
- ApplicationSleep();
- } else if ((! filename) || (filename[0] == '\0')) {
- return (Output());
- }
- if (filename) {
- printfilename = filename;
- }
- if (! (PrintHandle = Open (printfilename, PrintHandleMode))) {
- if (PrintHandleMode == MODE_OLDFILE) {
- PrintHandle = Open (printfilename, MODE_NEWFILE);
- }
- if (! PrintHandle)
- MyRequest ("Continue", "Couldn't open file \'%ls\'!", printfilename);
- }
- if (PrintHandle) {
- Seek (PrintHandle, NULL, OFFSET_END);
- }
- return (PrintHandle);
- }
-
- void HandlePrintStop (void) {
- if (AP_Scout) {
- AwakeApplication();
- }
- if (PrintHandle) {
- Close (PrintHandle);
- }
- }
-
- /*********************************************************************
- WinFree-Handling
- Die Abkopplung einiger Windows wird hiermit realisiert!
- *********************************************************************/
- struct WinFree *WinFree_ToDo;
- struct WinFlag *WinFlag_ToDo;
-
- struct WinFree FirstWinFree = {
- (APTR) NULL, (struct Remember *) NULL,
- &FirstWinFree, &FirstWinFree
- };
-
- void RemoveWinFree (void) {
- if (SingleDetailWinFree == WinFree_ToDo) {
- SingleDetailWinFree = NULL;
- }
-
- SetWindowClose (WinFree_ToDo->wf_Window,FALSE);
- FreeRemember (&WinFree_ToDo->wf_RememberKey, TRUE);
-
- WinFree_ToDo->wf_Next->wf_Previous = WinFree_ToDo->wf_Previous;
- WinFree_ToDo->wf_Previous->wf_Next = WinFree_ToDo->wf_Next;
-
- FreeMem (WinFree_ToDo, sizeof (struct WinFree));
- }
-
- struct WinFree *AllocWinFree (void) {
- struct WinFree *result;
-
- if (result = AllocMem (sizeof (struct WinFree), MEMF_ANY|MEMF_CLEAR)) {
- result->wf_Next = &FirstWinFree;
- result->wf_Previous = FirstWinFree.wf_Previous;
- result->wf_Previous->wf_Next = result;
- result->wf_Next->wf_Previous = result;
- }
- return (result);
- }
-
- void FreeMemoryOfAllWinFrees (void) {
- struct WinFree *lauf = FirstWinFree.wf_Next, *next;
-
- while (lauf != &FirstWinFree) {
- next = lauf->wf_Next;
-
- FreeRemember (&lauf->wf_RememberKey, TRUE);
- FreeMem (lauf, sizeof (struct WinFree));
-
- lauf = next;
- }
- }
-
- /*********************************************************************
- Fail
- Diese Routine wird zum Schluß des Programmes aufgerufen!
- *********************************************************************/
- static VOID fail1 (VOID) {
- Forbid();
- if (FindPort ("AMITCP")) {
- Permit();
- failtcp();
- } else {
- Permit();
- }
-
- if (ScoutPortAdded)
- RemPort (&ScoutPort);
-
- FreeSignal (TimerSignal);
-
- if (!timer2) {
- AbortIO ((struct IORequest *) &TimerIORequest);
- CloseDevice ((struct IORequest *) &TimerIORequest);
- }
- if (!input) CloseDevice ((struct IORequest *) &InputIORequest);
-
- if (prevdir)
- CurrentDir (prevdir);
-
- FreeLibraries();
- FreeDevices();
- FreeResources();
-
- FreeTasks();
- FreePorts();
- FreeCommands();
-
- FreeExpansions();
- FreeMemory();
- FreeResidents();
-
- FreeAssigns();
- FreeLocks();
- FreeMounts();
-
- FreeInputHandler();
- FreeInterrupts();
-
- FreeFonts();
- FreeSemaphores();
- FreeWindows();
-
- FreeTimer();
- FreeLowMemory();
- FreeSMode();
- FreeCx();
- FFreeClass();
- FreeSystem();
-
- FreeRemember (&GlobalRememberKey, TRUE);
-
- if (RexxSysBase) CloseLibrary (RexxSysBase);
- if (ExpansionBase) CloseLibrary (ExpansionBase);
- if (IdentifyBase) CloseLibrary (IdentifyBase);
- if (CxBase) CloseLibrary (CxBase);
- if (AslBase) CloseLibrary (AslBase);
- if (DiskfontBase) CloseLibrary (DiskfontBase);
- if (UtilityBase) CloseLibrary (UtilityBase);
- if (IconBase) CloseLibrary (IconBase);
- if (IntuitionBase) CloseLibrary ((struct Library *) IntuitionBase);
- if (GfxBase) CloseLibrary ((struct Library *) GfxBase);
- }
-
- static VOID fail (VOID) {
- if (cheattask) RemoveCheatTask();
-
- if (AP_Scout) {
- MUI_DisposeObject (AP_Scout);
- AP_Scout = NULL;
- }
- FreeMemoryOfAllWinFrees();
-
- if (MUIMasterBase) CloseLibrary (MUIMasterBase);
-
- fail1();
- }
-
- struct Library *MyOpenLibrary (char *libname, ULONG version) {
- struct Library *libbase;
-
- if (!(libbase = OpenLibrary(libname,version))) {
- aprintf ("Failed to open %ls version %ld!\n", libname, version);
- }
- return (libbase);
- }
-
- /*********************************************************************
- Init
- Diese Routine wird am Beginn des Programmes aufgerufen!
- *********************************************************************/
- static int init1 (VOID) {
- GfxBase = (struct GfxBase *) OpenLibrary (GRAPHICS_LIBNAME,MYLIBVERSION);
- IntuitionBase = (struct IntuitionBase *) OpenLibrary (INTUITION_LIBNAME,MYLIBVERSION);
- IconBase = OpenLibrary (ICON_LIBNAME,MYLIBVERSION);
- UtilityBase = OpenLibrary (UTILITY_LIBNAME,MYLIBVERSION);
-
- if ((!GfxBase) || (!IntuitionBase) || (!IconBase) || (!UtilityBase))
- return (FALSE);
-
- if (!(AslBase = MyOpenLibrary (ASL_LIBNAME,MYLIBVERSION)))
- return (FALSE);
-
- if (!(DiskfontBase = MyOpenLibrary (DISKFONT_LIBNAME,MYLIBVERSION)))
- return (FALSE);
-
- IdentifyBase = OpenLibrary(IDENTIFY_LIBNAME,IDENTIFYVERSION);
-
- if (!(CxBase = MyOpenLibrary (CX_LIBNAME,MYLIBVERSION)))
- return (FALSE);
-
- if (!(ExpansionBase = MyOpenLibrary (EXPANSION_LIBNAME,MYLIBVERSION)))
- return (FALSE);
-
- if (!(RexxSysBase = MyOpenLibrary (REXXSYS_LIBNAME,0)))
- return (FALSE);
-
- MiscBase = OpenResource("misc.resource");
- CiaABase = OpenResource("ciaa.resource");
- CiaBBase = OpenResource("ciab.resource");
-
- if (tmpstr = AllocRemember (&GlobalRememberKey, MAXTEXTLENGTH * 3 + 3, MEMF_ANY|MEMF_CLEAR)) {
- tmpstr2 = tmpstr + MAXTEXTLENGTH + 1;
- printfilename = tmpstr2 + MAXTEXTLENGTH + 1;
- strcpy (printfilename, "prt:");
- } else {
- return (FALSE);
- }
- myprocess = FindTask (NULL);
- prevdir = CurrentDir (((struct Process *) myprocess)->pr_HomeDir);
-
- if (input = OpenDevice (INPUT_DEVNAME, NULL, (struct IORequest *) &InputIORequest, NULL)) {
- aprintf ("Failed to open %ls!\n", INPUT_DEVNAME);
- return (FALSE);
- }
-
- if (timer2 = OpenDevice (TIMER_DEVNAME, NULL, (struct IORequest *) &TimerIORequest, NULL)) {
- aprintf ("Failed to open %ls!\n", TIMER_DEVNAME);
- return (NULL);
- }
-
- TimerSignal = AllocSignal (-1);
-
- ScoutPort.mp_Node.ln_Name = "scout.reply";
- ScoutPort.mp_Node.ln_Pri = 1;
- ScoutPort.mp_SigTask = myprocess;
- ScoutPort.mp_SigBit = TimerSignal;
-
- AddPort (&ScoutPort);
- ScoutPortAdded = TRUE;
- InputIORequest.io_Message.mn_ReplyPort = &ScoutPort;
- TimerIORequest.tr_node.io_Message.mn_ReplyPort = &ScoutPort;
-
-
- return (TRUE);
- }
-
- static int init2 (VOID) {
- if (!(MUIMasterBase = MyOpenLibrary (MUIMASTER_LIBNAME,MUIVERSION)))
- return (NULL);
-
- return (TRUE);
- }
-
- /*********************************************************************
- Allerlei Funktionen
- *********************************************************************/
- void reverse (char s[]) {
- int c, i, j;
- for (i = 0, j = strlen(s)-1; i < j; i++, j--) {
- c = s[i];
- s[i] = s[j];
- s[j] = c;
- }
- }
-
- char * ltob (ULONG n, int len) {
- static char s[34];
- int i;
- i = 0;
-
- do {
- s[i++] = n % 2 + '0';
- n /= 2;
- } while (--len > 0);
- s[i] = '\0';
- reverse (s);
- return ((char *) &s);
- }
-
- void healstring (char s[]) {
- int i = 0;
-
- while (s[i++] != '\0') {
- if ((s[i] > '\xfe') && (s[i] <= '\x7')) {
- s[i] = '\0';
- } else if ((s[i] > '\x7') && (s[i] <= '\x11')) {
- s[i] = ' ';
- }
- }
- }
-
- char * nonetest (char s[]) {
- int i = 0;
- char *none = "<none>";
- unsigned char *t = (unsigned char *) s;
-
- if ((s <= (char *) 0x200) || (s[0] == 0))
- return (none);
-
- while (t[i] != 0) {
- if (!(((t[i] > 8) && (t[i] < 128)) || ((t[i] > 159) && (t[i] != 215) && (t[i] != 247) && (t[i] != 255))))
- return (none);
- i++;
- }
- return (s);
- }
-
- int GetRamPointerCount (struct Library *lib) {
- int negsize;
- int count = 0, offset = 0;
- APTR value;
- char *adr;
-
- adr = (char *) lib;
- negsize = lib->lib_NegSize;
-
- while (((offset += 6) <= negsize) && *(WORD *)(adr - offset)) {
- if (*(WORD *)(adr - offset) == 0x4ef9) {
- value = (APTR) *(LONG *)(adr - offset + 2);
- if ((points2ram(value)) || (!value))
- count += 1;
- }
- }
-
- if (offset >= negsize) {
- return (count);
- } else {
- return (-1);
- }
- }
-
- /*********************************************************************
- Memory
- *********************************************************************/
- struct MemoEntry {
- struct MemoEntry *mem_next;
- struct MemHeader *mem_adr;
- char mem_address[10];
- char mem_name[NODENAMELENGTH+2];
- char mem_type[NODETYPELEN+1];
- char mem_pri[10];
- char mem_lower[10];
- char mem_upper[10];
- char mem_attributes[10];
- };
-
- __asm LONG memlist_dspfunc(register __a2 char **array, register __a1 struct MemoEntry *mementry, register __a0 struct Hook *hook) {
- if (mementry) {
- *array++ = mementry->mem_address;
- *array++ = mementry->mem_name;
- *array++ = mementry->mem_type;
- *array++ = mementry->mem_pri;
- *array++ = mementry->mem_lower;
- *array++ = mementry->mem_upper;
- *array++ = mementry->mem_attributes;
- *array = NULL;
- } else {
- *array++ = ESC "bAddress";
- *array++ = ESC "bln_Name";
- *array++ = ESC "bln_Type";
- *array++ = ESC "bln_Pri";
- *array++ = ESC "bmh_Lower";
- *array++ = ESC "bmh_Upper";
- *array++ = ESC "bmh_Attr";
- *array = NULL;
- }
- return(0);
- }
-
- struct Hook memlist_dsphook = {
- {NULL, NULL},
- (ULONG (* )())memlist_dspfunc,
- NULL, NULL
- };
-
- void FreeMemory (void) {
- MyFreeStructs (&MemRememberKey, memtext, memlist);
- }
-
- int GetMemory (struct MemoEntry **first) {
- struct MemHeader *mem;
- struct MemoEntry *mementry,*previous = NULL;
-
- int memcnt = 0;
- *first = 0;
-
- mem = FIRSTMEMORY;
-
- if (clientstate) {
- if (SendDaemon ("GetMemList")) {
- while ((mementry = AllocRemember (&MemRememberKey, sizeof (struct MemoEntry), MEMF_ANY|MEMF_CLEAR)) \
- && (ReceiveDecodedEntry ((UBYTE *) mementry, sizeof (struct MemoEntry)))) {
- IsHex (mementry->mem_address, (long *) &mementry->mem_adr);
-
- if (! *first)
- *first = mementry;
- if (previous)
- previous->mem_next = mementry;
-
- memcnt++;
- previous = mementry;
- }
- }
- } else {
- while ((mem->mh_Node.ln_Succ != 0) && (mementry = AllocRemember (&MemRememberKey, sizeof (struct MemoEntry), MEMF_ANY|MEMF_CLEAR))) {
- if (! *first)
- *first = mementry;
- if (previous)
- previous->mem_next = mementry;
-
- mementry->mem_adr = mem;
-
- sprintf (mementry->mem_address, "$%08x", mem);
- strncpy (mementry->mem_name, nonetest (mem->mh_Node.ln_Name), 20);
- strcpy (mementry->mem_type, GetNodeType (mem->mh_Node.ln_Type));
- sprintf (mementry->mem_pri, "%4d ", mem->mh_Node.ln_Pri);
- sprintf (mementry->mem_lower, "$%08x", mem->mh_Lower);
- sprintf (mementry->mem_upper, "$%08x", mem->mh_Upper);
- sprintf (mementry->mem_attributes, " $%04x", mem->mh_Attributes);
- memcnt++;
-
- previous = mementry;
- mem = (struct MemHeader *) mem->mh_Node.ln_Succ;
- }
- }
- return (memcnt);
- }
-
- void PrintMemory (char *filename) {
- int i=1;
- BPTR handle;
- struct MemoEntry *entryp;
-
- handle = HandlePrintStart (filename);
- if ((handle) && (PrintOneLine (handle, "\n Address Name Type Pri Lower Upper Attr\n\n"))) {
- if (! WI_Memory) {
- i = GetMemory (&entryp);
- }
- if (i) {
- for (i=0;;i++) {
- if (WI_Memory)
- DoMethod (memlist,MUIM_List_GetEntry,i,&entryp);
- if (!entryp) break;
-
- sprintf (tmpstr2, " %ls %-20.20ls %-8ls%4ls %ls %ls %ls\n", entryp->mem_address, entryp->mem_name, entryp->mem_type, entryp->mem_pri, entryp->mem_lower, entryp->mem_upper, entryp->mem_attributes);
- if (! (PrintOneLine (handle, tmpstr2)))
- break;
-
- if (! WI_Memory)
- entryp = entryp->mem_next;
- }
- }
- }
- HandlePrintStop();
- }
-
- void ShowMemory (void) {
- struct MemHeader *mem;
- struct MemoEntry *memo;
-
- mem = FIRSTMEMORY;
-
- ApplicationSleep();
- set (memlist,MUIA_List_Quiet,TRUE);
- set (BT_MemPriority, MUIA_Disabled, TRUE);
- set (BT_MemMore, MUIA_Disabled, TRUE);
-
- FreeMemory();
- GetMemory (&memo);
-
- while (memo) {
- InsertBottomEntry (memlist, (APTR *) &memo);
- memo = memo->mem_next;
- }
-
- AwakeApplication();
- set (memlist,MUIA_List_Quiet,FALSE);
- }
-
- void SendMemList (void) {
- struct MemoEntry *memo;
-
- FreeMemory();
- GetMemory (&memo);
-
- while (memo) {
- SendEncodedEntry ((UBYTE *) memo, sizeof (struct MemoEntry));
- memo = memo->mem_next;
- }
- FreeMemory();
- }
-
- __asm LONG memmore_dspfunc(register __a2 char **array, register __a1 struct HunkEntry *hunkentry, register __a0 struct Hook *hook) {
- if (hunkentry) {
- *array++ = hunkentry->he_lower;
- *array++ = hunkentry->he_upper;
- *array++ = hunkentry->he_size;
- *array = NULL;
- } else {
- *array++ = ESC "bStart";
- *array++ = ESC "bEnd";
- *array++ = ESC "bSize";
- *array++ = NULL;
- }
- return (0);
- }
-
- struct Hook memmore_dsphook = {
- {NULL, NULL},
- (ULONG (* )())memmore_dspfunc,
- NULL, NULL
- };
-
-
- void GetChunkList (struct MemHeader *mem, struct Remember **remkey) {
- #define mementryanzahl 20
-
- struct HunkEntry *hunkentry,*chunkmem;
- struct MemChunk *first,*chunk;
- ULONG size;
- int count = 0;
-
- set(memmorelist,MUIA_List_Quiet,TRUE);
-
- if (first = mem->mh_First) {
-
- chunk = first;
- while (chunk) {
- count++;
- chunk = chunk->mc_Next;
- }
- count += 10;
-
- if (chunkmem = AllocRemember (remkey, count * sizeof (struct HunkEntry), MEMF_ANY|MEMF_CLEAR)) {
-
- chunk = first;
- hunkentry = chunkmem;
- while ((count) && (chunk)) {
- size = chunk->mc_Bytes;
- sprintf (hunkentry->he_lower, "$%08x", chunk);
- sprintf (hunkentry->he_size, "%8d", size);
- sprintf (hunkentry->he_upper, "$%08x", ((char *) chunk) + size);
-
- InsertBottomEntry (memmorelist, (APTR *) &hunkentry);
-
- hunkentry += 1;
- chunk = chunk->mc_Next;
- count--;
- }
- }
- }
- set(memmorelist,MUIA_List_Quiet,FALSE);
- }
-
- void GetMemTypeToTmpstr (ULONG attributes) {
- int i=0;
-
- ULONG memtype[] = { MEMF_PUBLIC,MEMF_CHIP,MEMF_FAST,
- MEMF_LOCAL,MEMF_24BITDMA,MEMF_KICK,
- MEMF_CLEAR,MEMF_LARGEST,MEMF_REVERSE,MEMF_TOTAL,
- MEMF_ANY };
-
- char *memtext[] = { "PUBLIC","CHIP","FAST",
- "LOCAL","24BITDMA","KICK",
- "CLEAR","LARGEST","REVERSE","TOTAL" };
-
- tmpstr[0] = '\0';
- while (memtype[i]) {
- if (attributes & memtype[i]) {
- if (strlen (tmpstr))
- strcat (tmpstr, ", ");
- strcat (tmpstr, memtext[i]);
- }
- i++;
- }
- if (!attributes)
- strcpy (tmpstr, "ANY");
- }
-
- void GetMemMore (struct MemHeader *mem) {
- int total, inuse;
-
- unsigned char *title = "MEMORY: ";
- struct WinFree *ptr;
-
- if (ptr = AllocWinFree()) {
- ptr->wf_Window = (APTR) WindowObject,
-
- // MUIA_Window_SizeGadget, FALSE,
- MUIA_HelpNode, MemoryText,
- MUIA_Window_ID, MakeDetailID('.','M','E','M'),
- WindowContents, HGroup,
- Child, VGroup, MUIA_Group_SameWidth, TRUE,
- Child, MyLabel2 ("Name:"),
- Child, MyLabel2 ("Address:\nPri:\nType:\nFree:\nLargest:"),
- Child, MyLabel2 ("Attributes:"),
- Child, MyLabel2 ("\nChunks:"),
- Child, MyVSpace(0),
- End,
- Child, VGroup, MUIA_Group_SameWidth, TRUE,
- Child, memmoretext0 = MyTextObject(),
- Child, HGroup,
- Child, memmoretext1 = MyTextObject2(),
- Child, MyLabel ("First:\nLower:\nUpper:\nInUse:\nTotal:"),
- Child, memmoretext2 = MyTextObject2(),
- End,
- Child, memmoretext3 = MyTextObject(),
- Child, memmorelist = ListviewObject,
- MUIA_Listview_DoubleClick, TRUE,
- MUIA_Listview_Input, FALSE,
- MUIA_Listview_List, ListObject,
- MUIA_List_Format, "COL=0 DELTA=8,COL=1 DELTA=8,COL=2 P=\33r",
- // MUIA_List_AdjustWidth, TRUE,
- MUIA_List_Title, TRUE,
- MUIA_List_DisplayHook, &memmore_dsphook,
- ReadListFrame,
- End, End,
- End,
- End, End;
-
- total = ((int) mem->mh_Upper) - ((int) mem->mh_Lower);
- inuse = total - ((int) mem->mh_Free);
-
- if (ptr->wf_Window) {
- GetChunkList(mem, &ptr->wf_RememberKey);
-
- MySetContents (memmoretext1, ESC "r$%08x\n" ESC "c%d\n%s\n" ESC "r%d\n%d", mem, mem->mh_Node.ln_Pri, GetNodeType (mem->mh_Node.ln_Type), mem->mh_Free, AvailMem (MEMF_LARGEST | mem->mh_Attributes));
- MySetContents (memmoretext2, ESC "r$%08x\n$%08x\n$%08x\n%d\n%d", mem->mh_First, mem->mh_Lower, mem->mh_Upper, inuse, total);
-
- GetMemTypeToTmpstr ((ULONG) mem->mh_Attributes);
- set (memmoretext3, MUIA_Text_Contents, tmpstr);
-
- HandleWindowOpen (ptr, title, nonetest (mem->mh_Node.ln_Name));
- set (ptr->wf_Window,MUIA_Window_ActiveObject,memmorelist);
- set (memmoretext0, MUIA_Text_Contents, nonetest (mem->mh_Node.ln_Name));
- HandleWindowClose (ptr);
- }
- }
- }
-
-
- /*********************************************************************
- Interrupts
- *********************************************************************/
- struct IntEntry {
- struct IntEntry *int_next;
- char *int_adr;
- char int_address[10];
- char int_name[NODENAMELENGTH+2];
- char int_pri[10];
- char int_data[10];
- char int_code[20];
- char int_num[4];
- char int_kind[10];
- int int_number;
- };
-
- __asm LONG intlist_dspfunc(register __a2 char **array, register __a1 struct IntEntry *intentry, register __a0 struct Hook *hook) {
- if (intentry) {
- *array++ = intentry->int_address;
- *array++ = intentry->int_name;
- *array++ = intentry->int_pri;
- *array++ = intentry->int_data;
- *array++ = intentry->int_code;
- *array++ = intentry->int_num;
- *array++ = intentry->int_kind;
- *array = NULL;
- } else {
- *array++ = ESC "bAddress";
- *array++ = ESC "bln_Name";
- *array++ = ESC "bln_Pri";
- *array++ = ESC "bis_Data";
- *array++ = ESC "bis_Code";
- *array++ = ESC "bNUM";
- *array++ = ESC "bIntType";
- *array++ = NULL;
- }
- return(0);
- }
-
- struct Hook intlist_dsphook = {
- {NULL, NULL},
- (ULONG (* )())intlist_dspfunc,
- NULL, NULL
- };
-
- void FreeInterrupts (void) {
- MyFreeStructs (&IntRememberKey, inttext, intlist);
- }
-
- APTR GetInterrupts (int si_job, char *name, struct IntEntry **first) {
- struct IntVector *intvec;
- struct Interrupt *intr,*intradr;
- char *mark;
- struct Node *intnode;
- struct IntEntry *intentry,*previous = NULL;
- int i;
-
- int intcnt = 0;
- if (first)
- *first = 0;
-
- IsHex (name, (long *) &intradr);
-
- if (clientstate) {
- if (SendDaemon ("GetIntList")) {
- while ((intentry = AllocRemember (&IntRememberKey, sizeof (struct IntEntry), MEMF_ANY|MEMF_CLEAR)) \
- && (ReceiveDecodedEntry ((UBYTE *) intentry, sizeof (struct IntEntry)))) {
- IsHex (intentry->int_address, (long *) &intentry->int_adr);
-
- if (! *first)
- *first = intentry;
- if (previous)
- previous->int_next = intentry;
-
- intcnt++;
- previous = intentry;
- }
- }
- } else {
- for (i = 0; i <= 15; i++) {
- if (intvec = (struct IntVector *) &(SysBase->IntVects[i])) {
- if (intnode = intvec->iv_Node) {
- if ((si_job == SI_LIST) && (intvec->iv_Code) && (intentry = AllocRemember (&IntRememberKey, sizeof (struct IntEntry), MEMF_ANY|MEMF_CLEAR))) {
- if (! *first)
- *first = intentry;
- if (previous)
- previous->int_next = intentry;
-
- intentry->int_adr = (char *) intnode;
-
- if (points2ram((APTR) intvec->iv_Code)) {
- sprintf (intentry->int_code, HELL "$%08x", intvec->iv_Code);
- } else {
- sprintf (intentry->int_code, "$%08x", intvec->iv_Code);
- }
- sprintf (intentry->int_address, "$%08x", intnode);
- strncpy (intentry->int_name, nonetest (intnode->ln_Name), 26);
- sprintf (intentry->int_pri, "%4d ", intnode->ln_Pri);
- sprintf (intentry->int_data, "$%08x", intvec->iv_Data);
- sprintf (intentry->int_num, "%2d ", i);
- strcpy (intentry->int_kind, "Handler");
-
- intcnt++;
- previous = intentry;
- } else if ((si_job == SI_FIND) && (! stricmp (name, intnode->ln_Name))) {
- return ((APTR) intnode);
- } else if ((si_job == SI_REMOVE) && (! stricmp (name, intnode->ln_Name))) {
- return (NULL);
- }
- if (intvec = (struct IntVector *) intnode->ln_Succ) {
- intnode = intvec->iv_Node;
- }
- } else if ((mark = (char *) intvec->iv_Data) && (mark != (char *) -1)) {
- intr = (struct Interrupt *) ((struct Interrupt *) mark)->is_Node.ln_Succ;
- mark += 4;
-
- while ((intr) && (intr != (struct Interrupt *) mark)) {
- if ((si_job == SI_LIST) && (intentry = AllocRemember (&IntRememberKey, sizeof (struct IntEntry), MEMF_ANY|MEMF_CLEAR))) {
- if (! *first)
- *first = intentry;
- if (previous)
- previous->int_next = intentry;
-
- intentry->int_adr = (char *) intr;
-
- if (points2ram((APTR) intr->is_Code)) {
- sprintf (intentry->int_code, HELL "$%08x", intr->is_Code);
- } else {
- sprintf (intentry->int_code, "$%08x", intr->is_Code);
- }
- sprintf (intentry->int_address, "$%08x", intr);
- strncpy (intentry->int_name, nonetest (intr->is_Node.ln_Name), 26);
- sprintf (intentry->int_pri, "%4d ", intr->is_Node.ln_Pri);
- sprintf (intentry->int_data, "$%08x", intr->is_Data);
- sprintf (intentry->int_num, "%2d ", i);
- strcpy (intentry->int_kind, "Server");
-
- intcnt++;
- previous = intentry;
- } else if ((si_job == SI_FIND) && (! stricmp (name, intr->is_Node.ln_Name))) {
- return ((APTR) intr);
- } else if ((si_job == SI_REMOVE) && (! stricmp (name, intr->is_Node.ln_Name))) {
- RemIntServer (i, intr);
- return ((APTR) intr);
- }
- intr = (struct Interrupt *) intr->is_Node.ln_Succ;
- }
- }
- }
- }
- }
- if (si_job == SI_LIST) {
- return ((APTR) intcnt);
- }
- return (NULL);
- }
-
- void PrintInterrupts (char *filename) {
- int i=1;
- BPTR handle;
- struct IntEntry *entryp;
-
- handle = HandlePrintStart (filename);
- if ((handle) && (PrintOneLine (handle, "\n Address Pri Data Code NUM IntType Name\n\n"))) {
- if (! WI_Interrupts) {
- i = (int) GetInterrupts (SI_LIST, NULL, &entryp);
- }
- if (i) {
- for (i=0;;i++) {
- if (WI_Interrupts)
- DoMethod (intlist,MUIM_List_GetEntry,i,&entryp);
- if (!entryp) break;
-
- if (entryp->int_code[0] != '$')
- strcpy (tmpstr, entryp->int_code+2);
- else
- strcpy (tmpstr, entryp->int_code);
-
- sprintf (tmpstr2, " %ls %ls%ls %ls %ls%-7.7ls %ls\n", entryp->int_address, entryp->int_pri, entryp->int_data, tmpstr, entryp->int_num, entryp->int_kind, entryp->int_name);
- if (! (PrintOneLine (handle, tmpstr2)))
- break;
-
- if (! WI_Interrupts)
- entryp = entryp->int_next;
- }
- }
- }
- HandlePrintStop();
- }
-
- void ShowInterrupts (void) {
- struct IntEntry *intr;
-
- ApplicationSleep();
- set (intlist,MUIA_List_Quiet,TRUE);
- set (BT_IntRemove, MUIA_Disabled, TRUE);
- set (BT_IntMore, MUIA_Disabled, TRUE);
-
- FreeInterrupts();
- intcnt = (int) GetInterrupts (SI_LIST, NULL, &intr);
-
- while (intr) {
- InsertBottomEntry (intlist, (APTR *) &intr);
- intr = intr->int_next;
- }
-
- SetCountText (intcount, intcnt);
- AwakeApplication();
- set (intlist,MUIA_List_Quiet,FALSE);
- }
-
- void SendIntList (void) {
- struct IntEntry *intr;
-
- FreeInterrupts();
- intcnt = (int) GetInterrupts (SI_LIST, NULL, &intr);
-
- while (intr) {
- SendEncodedEntry ((UBYTE *) intr, sizeof (struct IntEntry));
- intr = intr->int_next;
- }
- FreeInterrupts();
- }
-
- void GetIntMore (struct IntEntry *intr) {
- unsigned char *title = "INTERRUPT: ";
- struct WinFree *ptr;
-
- if (ptr = AllocWinFree()) {
- ptr->wf_Window = (APTR) WindowObject,
-
- // MUIA_Window_SizeGadget, FALSE,
- MUIA_HelpNode, InterruptsText,
- MUIA_Window_ID, MakeDetailID('.','I','N','T'),
- WindowContents, HGroup,
- Child, VGroup, MUIA_Group_SameWidth, TRUE,
- Child, MyLabel2 ("Name:"),
- Child, MyLabel2 ("Address:\nPri:\nType:"),
- Child, MyLabel2 ("IntName:"),
- End,
- Child, VGroup, MUIA_Group_SameWidth, TRUE,
- Child, intmoretext0 = MyTextObject(),
- Child, HGroup,
- Child, intmoretext1 = MyTextObject2(),
- Child, MyLabel ("Data:\nCode:\nIntType:"),
- Child, intmoretext2 = MyTextObject2(),
- End,
- Child, intmoretext3 = MyTextObject(),
- End,
- End, End;
-
- if (ptr->wf_Window) {
- MySetContents (intmoretext1, ESC "r%s\n" ESC "c%d\n" ESC "c%s", intr->int_address, ((struct Node *) intr->int_adr)->ln_Pri, GetNodeType (((struct Node *) intr->int_adr)->ln_Type));
- MySetContents (intmoretext2, ESC "r%s\n%s\n" DUNKEL ESC "c%s", intr->int_data, intr->int_code, intr->int_kind);
- MySetContents (intmoretext3, INT_TYPE[atoi(intr->int_num)]);
-
- HandleWindowOpen (ptr, title, intr->int_name);
- MySetContents (intmoretext0, intr->int_name);
- HandleWindowClose (ptr);
- }
- }
- }
-
-
- /*********************************************************************
- InputHandler
- *********************************************************************/
- struct InputEntry {
- struct InputEntry *input_next;
- struct Interrupt *input_adr;
- char input_address[10];
- char input_name[NODENAMELENGTH+2];
- char input_type[NODETYPELEN+1];
- char input_pri[10];
- char input_data[10];
- char input_code[20];
- };
-
- __asm LONG inputlist_dspfunc(register __a2 char **array, register __a1 struct InputEntry *inputentry, register __a0 struct Hook *hook) {
- if (inputentry) {
- *array++ = inputentry->input_address;
- *array++ = inputentry->input_name;
- *array++ = inputentry->input_type;
- *array++ = inputentry->input_pri;
- *array++ = inputentry->input_data;
- *array++ = inputentry->input_code;
- *array = NULL;
- } else {
- *array++ = ESC "bAddress";
- *array++ = ESC "bln_Name";
- *array++ = ESC "bln_Type";
- *array++ = ESC "bln_Pri";
- *array++ = ESC "bis_Data";
- *array++ = ESC "bis_Code";
- *array++ = NULL;
- }
- return(0);
- }
-
- struct Hook inputlist_dsphook = {
- {NULL, NULL},
- (ULONG (* )())inputlist_dspfunc,
- NULL, NULL
- };
-
- void FreeInputHandler (void) {
- MyFreeStructs (&InputRememberKey, inputtext, inputlist);
- }
-
- int GetInputHandler (struct InputEntry **first) {
- struct Interrupt *intr;
- struct Device *input;
- struct InputEntry *inputentry,*previous = NULL;
- char *tmp;
- char code[FILENAMELENGTH + 1];
-
- int inputcnt = 0;
- *first = 0;
-
- if (clientstate) {
- if (SendDaemon ("GetInputList")) {
- while ((inputentry = AllocRemember (&InputRememberKey, sizeof (struct InputEntry), MEMF_ANY|MEMF_CLEAR)) \
- && (ReceiveDecodedEntry ((UBYTE *) inputentry, sizeof (struct InputEntry)))) {
- IsHex (inputentry->input_address, (long *) &inputentry->input_adr);
-
- if (! *first)
- *first = inputentry;
- if (previous)
- previous->input_next = inputentry;
-
- inputcnt++;
- previous = inputentry;
- }
- }
- } else {
- if (input = (struct Device *) FindName (&SysBase->DeviceList, INPUT_DEVNAME)) {
- tmp = (APTR) input;
- tmp += 148; /* Mir unbekannter Offsetname! */
- if (intr = (struct Interrupt *) ((struct Interrupt *) tmp)->is_Node.ln_Succ) {
- if (intr = (struct Interrupt *) intr->is_Node.ln_Succ) {
- while ((intr->is_Node.ln_Succ != 0) && (inputentry = AllocRemember (&InputRememberKey, sizeof (struct InputEntry), MEMF_ANY|MEMF_CLEAR))) {
- if (! *first)
- *first = inputentry;
- if (previous)
- previous->input_next = inputentry;
-
- inputentry->input_adr = intr;
-
- code[0] = '\0';
- if (points2ram((APTR) intr->is_Code)) {
- sprintf (code, HELL "$%08x" DUNKEL, intr->is_Code);
- } else {
- sprintf (code, "$%08x", intr->is_Code);
- }
- sprintf (inputentry->input_address, "$%08x", intr);
- strncpy (inputentry->input_name, nonetest (intr->is_Node.ln_Name), 27);
- strcpy (inputentry->input_type, GetNodeType (intr->is_Node.ln_Type));
- sprintf (inputentry->input_pri, "%4d ", intr->is_Node.ln_Pri);
- sprintf (inputentry->input_data, "$%08x", intr->is_Data);
- strcpy (inputentry->input_code, code);
- inputcnt++;
-
- previous = inputentry;
- intr = (struct Interrupt *) intr->is_Node.ln_Succ;
- }
- }
- }
- }
- }
- return (inputcnt);
- }
-
- void PrintInputHandlers (char *filename) {
- int i=1;
- BPTR handle;
- struct InputEntry *entryp;
-
- handle = HandlePrintStart (filename);
- if ((handle) && (PrintOneLine (handle, "\n Address Type Pri Data Code Name\n\n"))) {
- if (! WI_InputHandler) {
- i = GetInputHandler (&entryp);
- }
- if (i) {
- for (i=0;;i++) {
- if (WI_InputHandler)
- DoMethod (inputlist,MUIM_List_GetEntry,i,&entryp);
- if (!entryp) break;
-
- if (points2ram ((APTR) (entryp->input_adr->is_Code)))
- strcpy (tmpstr, entryp->input_code+2);
- else
- strcpy (tmpstr, entryp->input_code);
-
- sprintf (tmpstr2, " %ls %-9ls %4ls %ls %-9.9ls %ls\n", entryp->input_address, entryp->input_type, entryp->input_pri, entryp->input_data, tmpstr, entryp->input_name);
- if (! (PrintOneLine (handle, tmpstr2)))
- break;
-
- if (! WI_InputHandler)
- entryp = entryp->input_next;
- }
- }
- }
- HandlePrintStop();
- }
-
- void ShowInputHandler (void) {
- struct InputEntry *input;
-
- ApplicationSleep();
- set (inputlist,MUIA_List_Quiet,TRUE);
- set (BT_InputRemove, MUIA_Disabled, TRUE);
- set (BT_InputPriority, MUIA_Disabled, TRUE);
-
- FreeInputHandler();
- inputcnt = GetInputHandler (&input);
-
- while (input) {
- InsertBottomEntry (inputlist, (APTR *) &input);
- input = input->input_next;
- }
-
- SetCountText (inputcount, inputcnt);
- AwakeApplication();
- set (inputlist,MUIA_List_Quiet,FALSE);
- }
-
- void SendInputList (void) {
- struct InputEntry *input;
-
- FreeInputHandler();
- inputcnt = GetInputHandler (&input);
-
- while (input) {
- SendEncodedEntry ((UBYTE *) input, sizeof (struct InputEntry));
- input = input->input_next;
- }
- FreeInputHandler();
- }
-
- /*********************************************************************
- Residents
- *********************************************************************/
- struct ResiEntry {
- struct ResiEntry *rt_next;
- struct Resident *rt_adr;
- char rt_address[16];
- char rt_name[NODENAMELENGTH+2];
- char rt_pri[10];
- char rt_idstring[TEXTLENGTH+1];
- };
-
- __asm LONG resilist_dspfunc(register __a2 char **array, register __a1 struct ResiEntry *resientry, register __a0 struct Hook *hook) {
- if (resientry) {
- *array++ = resientry->rt_address;
- *array++ = resientry->rt_name;
- *array++ = resientry->rt_pri;
- *array++ = resientry->rt_idstring;
- *array = NULL;
- } else {
- *array++ = ESC "bAddress";
- *array++ = ESC "bln_Name";
- *array++ = ESC "brt_Pri";
- *array++ = ESC "brt_IdString";
- *array++ = NULL;
- }
- return(0);
- }
-
- struct Hook resilist_dsphook = {
- {NULL, NULL},
- (ULONG (* )())resilist_dspfunc,
- NULL, NULL
- };
-
- void FreeResidents (void) {
- MyFreeStructs (&ResiRememberKey, resitext, resilist);
- }
-
- int GetResidents (struct ResiEntry **first) {
- LONG *resip, resi;
- struct ResiEntry *resientry,*previous = NULL;
- struct ShortList {
- struct Resident *sl_Resident;
- struct ShortList *sl_Next;
- };
- struct ShortList *sl_Actual;
-
- int resicnt = 0;
- *first = 0;
-
- sl_Actual = (struct ShortList *) SysBase->KickTagPtr;
-
- if (clientstate) {
- if (SendDaemon ("GetResiList")) {
- while ((resientry = AllocRemember (&ResiRememberKey, sizeof (struct ResiEntry), MEMF_ANY|MEMF_CLEAR)) \
- && (ReceiveDecodedEntry ((UBYTE *) resientry, sizeof (struct ResiEntry)))) {
- IsHex (resientry->rt_address, (long *) &resientry->rt_adr);
-
- if (! *first)
- *first = resientry;
- if (previous)
- previous->rt_next = resientry;
-
- resicnt++;
- previous = resientry;
- }
- }
- } else {
- while ((sl_Actual) && (sl_Actual->sl_Resident) && (resientry = AllocRemember (&ResiRememberKey, sizeof (struct ResiEntry), MEMF_ANY|MEMF_CLEAR))) {
- if (! *first)
- *first = resientry;
- if (previous)
- previous->rt_next = resientry;
-
- resientry->rt_adr = sl_Actual->sl_Resident;
-
- sprintf (resientry->rt_address, HELL "$%08x" DUNKEL, sl_Actual->sl_Resident);
- strncpy (resientry->rt_name, nonetest (sl_Actual->sl_Resident->rt_Name), NODENAMELENGTH);
- sprintf (resientry->rt_pri, "%4d", sl_Actual->sl_Resident->rt_Pri);
- strncpy (resientry->rt_idstring, nonetest (sl_Actual->sl_Resident->rt_IdString), TEXTLENGTH);
-
- healstring (resientry->rt_name);
- healstring (resientry->rt_idstring);
- resicnt++;
-
- previous = resientry;
- sl_Actual = (struct ShortList *) (0x7fffffff & (ULONG) sl_Actual->sl_Next);
- }
-
- resip = (LONG *) FIRSTRESIDENT;
-
- while ((resi = *resip) && (resientry = AllocRemember (&ResiRememberKey, sizeof (struct ResiEntry), MEMF_ANY|MEMF_CLEAR))) {
- if (! *first)
- *first = resientry;
- if (previous)
- previous->rt_next = resientry;
-
- if (0x80000000 & resi) {
- resip = (long *) (0x7fffffff & resi);
- resi = *resip;
- }
- resientry->rt_adr = (struct Resident *) resi;
- sprintf (resientry->rt_address, "$%08x", resi);
- strncpy (resientry->rt_name, nonetest (((struct Resident *) resi)->rt_Name), NODENAMELENGTH);
- sprintf (resientry->rt_pri, "%4d", ((struct Resident *) resi)->rt_Pri);
- strncpy (resientry->rt_idstring, nonetest (((struct Resident *) resi)->rt_IdString), TEXTLENGTH);
-
- healstring (resientry->rt_name);
- healstring (resientry->rt_idstring);
- resicnt++;
-
- previous = resientry;
- resip += 1; /* plus 4 Bytes */
- }
- }
- return (resicnt);
- }
-
- void PrintResidents (char *filename) {
- int i=1;
- BPTR handle;
- struct ResiEntry *entryp;
-
- handle = HandlePrintStart (filename);
- if ((handle) && (PrintOneLine (handle, "\n Address Name Pri IdString\n\n"))) {
- if (! WI_Residents) {
- i = GetResidents (&entryp);
- }
- if (i) {
- for (i=0;;i++) {
- if (WI_Residents)
- DoMethod (resilist,MUIM_List_GetEntry,i,&entryp);
- if (!entryp) break;
-
- sprintf (tmpstr2, " $%08lx %-23.23ls %4ls %ls\n", entryp->rt_adr, entryp->rt_name, entryp->rt_pri, entryp->rt_idstring);
- if (! (PrintOneLine (handle, tmpstr2)))
- break;
-
- if (! WI_Residents)
- entryp = entryp->rt_next;
- }
- }
- }
- HandlePrintStop();
- }
-
- void ShowResidents (void) {
- struct ResiEntry *resi;
-
- ApplicationSleep();
- set (resilist,MUIA_List_Quiet,TRUE);
- set (BT_ResiMore, MUIA_Disabled, TRUE);
-
- FreeResidents();
- resicnt = GetResidents (&resi);
-
- while (resi) {
- InsertBottomEntry (resilist, (APTR *) &resi);
- resi = resi->rt_next;
- }
-
- SetCountText (resicount, resicnt);
- AwakeApplication();
- set (resilist,MUIA_List_Quiet,FALSE);
- }
-
- void SendResiList (void) {
- struct ResiEntry *resi;
-
- FreeResidents();
- resicnt = GetResidents (&resi);
-
- while (resi) {
- SendEncodedEntry ((UBYTE *) resi, sizeof (struct ResiEntry));
- resi = resi->rt_next;
- }
- FreeResidents();
- }
-
- void GetResiMore (struct Resident *resi) {
- unsigned char *title = "RESIDENT: ";
- struct WinFree *ptr;
-
- if (ptr = AllocWinFree()) {
- ptr->wf_Window = (APTR) WindowObject,
-
- // MUIA_Window_SizeGadget, FALSE,
- MUIA_HelpNode, ResidentsText,
- MUIA_Window_ID, MakeDetailID('.','R','E','S'),
- WindowContents, HGroup,
- Child, VGroup, MUIA_Group_SameWidth, TRUE,
- Child, MyLabel2 ("Name:"),
- Child, MyLabel2 ("Address:\nPri:\nType:\nVersion:"),
- Child, MyLabel2 ("IdString:"),
- End,
- Child, VGroup, MUIA_Group_SameWidth, TRUE,
- Child, resimoretext0 = MyTextObject(),
- Child, HGroup,
- Child, resimoretext1 = MyTextObject(),
- Child, VGroup,
- Child, MyLabel ("EndSkip:\nInit:"),
- Child, MyLabel ("Flags:"),
- End,
- Child, VGroup, MUIA_Group_SameWidth, TRUE,
- Child, resimoretext2a = MyTextObject(),
- Child, resimoretext2b = KeyButtonF ('b', resi->rt_Flags),
- End,
- End,
- Child, resimoretext3 = MyTextObject(),
- End,
- End, End;
-
- if (ptr->wf_Window) {
- MySetContents (resimoretext1, ESC "c$%08x\n%d\n%s\n%d", resi, resi->rt_Pri, GetNodeType (resi->rt_Type), resi->rt_Version);
- MySetContents (resimoretext2a, ESC "c$%08x\n$%08x", resi->rt_EndSkip, resi->rt_Init);
-
- HandleFlagsButtonPressed (resimoretext2b, ptr, "(RESIDENT)", "rt_Flags", resi->rt_Flags, (struct LongFlag *) &rtf_flags, NULL, 'b');
- HandleWindowOpen (ptr, title, resi->rt_Name);
- MySetContentsHealed (resimoretext0, resi->rt_Name);
- MySetContentsHealed (resimoretext3, nonetest (resi->rt_IdString));
- HandleWindowClose (ptr);
- }
- }
- }
-
-
- /*********************************************************************
- Vectors
- *********************************************************************/
- void ClearResetVectors (void) {
- SysBase->ColdCapture = NULL;
- SysBase->CoolCapture = NULL;
- SysBase->WarmCapture = NULL;
- SysBase->KickMemPtr = NULL;
- SysBase->KickTagPtr = NULL;
- SysBase->KickCheckSum = NULL;
- }
-
- void PrintVectors (char *filename) {
- char *VBR;
- BPTR handle;
-
- VBR = (char *) GetVBR ();
-
- handle = HandlePrintStart (filename);
- if (handle) {
- if (clientstate) {
- char tmpbuffer[256];
-
- if (SendDaemon ("Vectors")) {
- while ((sgets (client_socket, tmpbuffer, 256)) \
- && (strcmp (tmpbuffer, CMD_DONE)) \
- && (strcmp (tmpbuffer, CMD_ERROR))) {
- PrintOneLine (handle, tmpbuffer);
- }
- }
- } else {
- if (PrintOneLine (handle, "\nReset Vectors:\n\n")) {
- sprintf (tmpstr2, " %18ls $%08lx %18ls $%08lx\n %18ls $%08lx %18ls $%08lx\n %18ls $%08lx %18ls $%08lx\n", "ColdCapture:",SysBase->ColdCapture,"KickMemPtr:",SysBase->KickMemPtr,"CoolCapture:",SysBase->CoolCapture,"KickTagPtr:",SysBase->KickTagPtr,"WarmCapture:",SysBase->WarmCapture,"KickCheckSum:",SysBase->KickCheckSum);
- PrintOneLine (handle, tmpstr2);
-
- PrintOneLine (handle, "\nAuto Vector Interrupts:\n\n");
-
- sprintf (tmpstr2, " %18ls $%08lx %18ls $%08lx\n %18ls $%08lx %18ls $%08lx\n %18ls $%08lx %18ls $%08lx\n %18ls $%08lx\n", "Level1 ($0064):",*((ULONG *) (VBR + 0x0064)),"Level5 ($0074):",*((ULONG *) (VBR + 0x0074)),"Level2 ($0068):",*((ULONG *) (VBR + 0x0068)),"Level6 ($0078):",*((ULONG *) (VBR + 0x0078)),"Level3 ($006c):",*((ULONG *) (VBR + 0x006c)),"Level7 ($007c):",*((ULONG *) (VBR + 0x007c)),"Level4 ($0070):",*((ULONG *) (VBR + 0x0070)));
- PrintOneLine (handle, tmpstr2);
-
- PrintOneLine (handle, "\nInterrupt Vectors:\n\n");
-
- sprintf (tmpstr2, " %18ls $%08lx %18ls $%08lx\n %18ls $%08lx %18ls $%08lx\n %18ls $%08lx %18ls $%08lx\n %18ls $%08lx %18ls $%08lx\n", "TBE 0:",SysBase->IntVects[0].iv_Code,"AUDIO1 8:",SysBase->IntVects[8].iv_Code,"DSKBLK 1:",SysBase->IntVects[1].iv_Code,"AUDIO2 9:",SysBase->IntVects[9].iv_Code,"SOFTINT 2:",SysBase->IntVects[2].iv_Code,"AUDIO3 10:",SysBase->IntVects[10].iv_Code,"PORTS 3:",SysBase->IntVects[3].iv_Code,"RBF 11:",SysBase->IntVects[11].iv_Code);
- PrintOneLine (handle, tmpstr2);
-
- sprintf (tmpstr2, " %18ls $%08lx %18ls $%08lx\n %18ls $%08lx %18ls $%08lx\n %18ls $%08lx %18ls $%08lx\n %18ls $%08lx %18ls $%08lx\n", "COPPER 4:",SysBase->IntVects[4].iv_Code,"DSKSYNC 12:",SysBase->IntVects[12].iv_Code,"VERTB 5:",SysBase->IntVects[5].iv_Code,"EXTER 13:",SysBase->IntVects[13].iv_Code,"BLITTER 6:",SysBase->IntVects[6].iv_Code,"INTEN 14:",SysBase->IntVects[14].iv_Code,"AUDIO0 7:",SysBase->IntVects[7].iv_Code,"NMI 15:",SysBase->IntVects[15].iv_Code);
- PrintOneLine (handle, tmpstr2);
- }
- }
- }
- HandlePrintStop();
- }
-
- void GetVectors (void) {
- char *VBR;
- int i = 0;
-
- if (clientstate) {
- char tmpbuffer[256];
-
- if (SendDaemon ("GetVectorList")) {
- if (sgets (client_socket, tmpbuffer, 256)) {
- MySetContents (vectext1, tmpbuffer);
- if (sgets (client_socket, tmpbuffer, 256)) {
- MySetContents (vectext2, tmpbuffer);
- if (sgets (client_socket, tmpbuffer, 256)) {
- MySetContents (vectext3, tmpbuffer);
- if (sgets (client_socket, tmpbuffer, 256)) {
- MySetContents (vectext4, tmpbuffer);
- if (sgets (client_socket, tmpbuffer, 256)) {
- strcmp (tmpbuffer, CMD_DONE);
- }
- }
- }
- }
- }
- }
- } else {
- VBR = (char *) GetVBR ();
-
- MySetContents (vectext1, ESC "r$%08x\n$%08x\n$%08x\n$%08x\n$%08x\n$%08x",SysBase->ColdCapture,SysBase->CoolCapture,SysBase->WarmCapture,SysBase->KickMemPtr,SysBase->KickTagPtr,SysBase->KickCheckSum);
- MySetContents (vectext2, ESC "r$%08x\n$%08x\n$%08x\n$%08x\n$%08x\n$%08x\n$%08x",*((ULONG *) (VBR + 0x0064)),*((ULONG *) (VBR + 0x0068)),*((ULONG *) (VBR + 0x006c)),*((ULONG *) (VBR + 0x0070)),*((ULONG *) (VBR + 0x0074)),*((ULONG *) (VBR + 0x0078)),*((ULONG *) (VBR + 0x007c)));
- MySetContents (vectext3, ESC "r$%08x\n$%08x\n$%08x\n$%08x\n$%08x\n$%08x\n$%08x\n$%08x",SysBase->IntVects[i++].iv_Code,SysBase->IntVects[i++].iv_Code,SysBase->IntVects[i++].iv_Code,SysBase->IntVects[i++].iv_Code,SysBase->IntVects[i++].iv_Code,SysBase->IntVects[i++].iv_Code,SysBase->IntVects[i++].iv_Code,SysBase->IntVects[i++].iv_Code);
- MySetContents (vectext4, ESC "r$%08x\n$%08x\n$%08x\n$%08x\n$%08x\n$%08x\n$%08x\n$%08x",SysBase->IntVects[i++].iv_Code,SysBase->IntVects[i++].iv_Code,SysBase->IntVects[i++].iv_Code,SysBase->IntVects[i++].iv_Code,SysBase->IntVects[i++].iv_Code,SysBase->IntVects[i++].iv_Code,SysBase->IntVects[i++].iv_Code,SysBase->IntVects[i++].iv_Code);
- }
- }
-
- void SendVectorList (void) {
- char *VBR;
- int i = 0;
-
- VBR = (char *) GetVBR ();
-
- SendClient (ESC "r$%08x\n$%08x\n$%08x\n$%08x\n$%08x\n$%08x",SysBase->ColdCapture,SysBase->CoolCapture,SysBase->WarmCapture,SysBase->KickMemPtr,SysBase->KickTagPtr,SysBase->KickCheckSum);
- SendClient (ESC "r$%08x\n$%08x\n$%08x\n$%08x\n$%08x\n$%08x\n$%08x",*((ULONG *) (VBR + 0x0064)),*((ULONG *) (VBR + 0x0068)),*((ULONG *) (VBR + 0x006c)),*((ULONG *) (VBR + 0x0070)),*((ULONG *) (VBR + 0x0074)),*((ULONG *) (VBR + 0x0078)),*((ULONG *) (VBR + 0x007c)));
- SendClient (ESC "r$%08x\n$%08x\n$%08x\n$%08x\n$%08x\n$%08x\n$%08x\n$%08x",SysBase->IntVects[i++].iv_Code,SysBase->IntVects[i++].iv_Code,SysBase->IntVects[i++].iv_Code,SysBase->IntVects[i++].iv_Code,SysBase->IntVects[i++].iv_Code,SysBase->IntVects[i++].iv_Code,SysBase->IntVects[i++].iv_Code,SysBase->IntVects[i++].iv_Code);
- SendClient (ESC "r$%08x\n$%08x\n$%08x\n$%08x\n$%08x\n$%08x\n$%08x\n$%08x",SysBase->IntVects[i++].iv_Code,SysBase->IntVects[i++].iv_Code,SysBase->IntVects[i++].iv_Code,SysBase->IntVects[i++].iv_Code,SysBase->IntVects[i++].iv_Code,SysBase->IntVects[i++].iv_Code,SysBase->IntVects[i++].iv_Code,SysBase->IntVects[i++].iv_Code);
- }
-
-
- /*********************************************************************
- Allocations
- *********************************************************************/
-
- static char alcnonalc[] = "<free>";
- static char alcunknown[] = "<allocated>";
- static char alcnotavail[] = "<not available>";
-
- static char * AlcMiscUser(ULONG unit) {
- char * name;
-
- if(!MiscBase) return(alcnotavail);
-
- if(!(name = AllocMiscResource(unit,"Scout")))
- FreeMiscResource(unit);
- return(name ? name : alcnonalc);
- }
-
- static char * AlcCiaAUser(WORD unit) {
- struct Interrupt *intr;
- char * name;
-
- if(!CiaABase) return(alcnotavail);
-
- Disable();
- if(!(intr = AddICRVector(CiaABase,unit,&DummyInt))) {
- RemICRVector(CiaABase,unit,&DummyInt);
- Enable();
- return(alcnonalc);
- }
- Enable();
- name = intr->is_Node.ln_Name;
- return(name ? name : alcunknown);
- }
-
- static char * AlcCiaBUser(WORD unit) {
- struct Interrupt *intr;
- char * name;
-
- if(!CiaBBase) return(alcnotavail);
-
- Disable();
- if(!(intr = AddICRVector(CiaBBase,unit,&DummyInt))) {
- RemICRVector(CiaBBase,unit,&DummyInt);
- Enable();
- return(alcnonalc);
- }
- Enable();
- name = intr->is_Node.ln_Name;
- return(name ? name : alcunknown);
- }
-
-
- void PrintAllocations (char *filename) {
- BPTR handle;
-
- handle = HandlePrintStart (filename);
- if (handle) {
- if (clientstate) {
- char tmpbuffer[256];
-
- if (SendDaemon ("Allocations")) {
- while ((sgets (client_socket, tmpbuffer, 256)) \
- && (strcmp (tmpbuffer, CMD_DONE)) \
- && (strcmp (tmpbuffer, CMD_ERROR))) {
- PrintOneLine (handle, tmpbuffer);
- }
- }
- } else {
- if (PrintOneLine (handle, "\nCIA A:\n\n")) {
- sprintf(tmpstr2, "Timer A: %s\nTimer B: %s\n Alarm: %s\n Serial: %s\n Flag: %s",AlcCiaAUser(0),AlcCiaAUser(1),AlcCiaAUser(2),AlcCiaAUser(3),AlcCiaAUser(4));
- PrintOneLine (handle, tmpstr2);
-
- PrintOneLine (handle, "\n\n\nCIA B:\n\n");
- sprintf(tmpstr2, "Timer A: %s\nTimer B: %s\n Alarm: %s\n Serial: %s\n Flag: %s",AlcCiaBUser(0),AlcCiaBUser(1),AlcCiaBUser(2),AlcCiaBUser(3),AlcCiaBUser(4));
- PrintOneLine (handle, tmpstr2);
-
- PrintOneLine (handle, "\n\n\nSerial & Parallel Ports:\n\n");
- sprintf(tmpstr2, " Serial Port: %s\n Serial Control: %s\n Parallel Port: %s\nParallel Control: %s",AlcMiscUser(MR_SERIALPORT),AlcMiscUser(MR_SERIALBITS),AlcMiscUser(MR_PARALLELPORT),AlcMiscUser(MR_PARALLELBITS));
- PrintOneLine (handle, tmpstr2);
- }
- }
- }
- HandlePrintStop();
- }
-
- void GetAllocations (void) {
- if (clientstate) {
- char tmpbuffer[256];
-
- if (SendDaemon ("GetAlcList")) {
- if (sgets (client_socket, tmpbuffer, 256)) {
- MySetContents (alctext1, tmpbuffer);
- if (sgets (client_socket, tmpbuffer, 256)) {
- MySetContents (alctext2, tmpbuffer);
- if (sgets (client_socket, tmpbuffer, 256)) {
- MySetContents (alctext3, tmpbuffer);
- if (sgets (client_socket, tmpbuffer, 256)) {
- strcmp (tmpbuffer, CMD_DONE);
- }
- }
- }
- }
- }
- } else {
- Forbid();
- MySetContents (alctext1, "%s\n%s\n%s\n%s\n%s",AlcCiaAUser(0),AlcCiaAUser(1),AlcCiaAUser(2),AlcCiaAUser(3),AlcCiaAUser(4));
- MySetContents (alctext2, "%s\n%s\n%s\n%s\n%s",AlcCiaBUser(0),AlcCiaBUser(1),AlcCiaBUser(2),AlcCiaBUser(3),AlcCiaBUser(4));
- MySetContents (alctext3, "%s\n%s\n%s\n%s",AlcMiscUser(MR_SERIALPORT),AlcMiscUser(MR_SERIALBITS),AlcMiscUser(MR_PARALLELPORT),AlcMiscUser(MR_PARALLELBITS));
- Permit();
- }
- }
-
- void SendAlcList (void) {
- SendClient (ESC "r%s\n%s\n%s\n%s\n%s",AlcCiaAUser(0),AlcCiaAUser(1),AlcCiaAUser(2),AlcCiaAUser(3),AlcCiaAUser(4));
- SendClient (ESC "r%s\n%s\n%s\n%s\n%s",AlcCiaBUser(0),AlcCiaBUser(1),AlcCiaBUser(2),AlcCiaBUser(3),AlcCiaBUser(4));
- SendClient (ESC "r%s\n%s\n%s\n%s",AlcMiscUser(MR_SERIALPORT),AlcMiscUser(MR_SERIALBITS),AlcMiscUser(MR_PARALLELPORT),AlcMiscUser(MR_PARALLELBITS));
- }
-
-
- /*********************************************************************
- System
- *********************************************************************/
- struct SystemEntry {
- struct SystemEntry *syse_next;
- char syse_desc[30];
- char syse_line[100];
- };
-
- __asm LONG syslist_dspfunc(register __a2 char **array, register __a1 struct SystemEntry *sysentry, register __a0 struct Hook *hook) {
- if (sysentry) {
- *array++ = sysentry->syse_desc;
- *array = sysentry->syse_line;
- }
- return(0);
- }
-
- struct Hook syslist_dsphook = {
- {NULL, NULL},
- (ULONG (* )())syslist_dspfunc,
- NULL, NULL
- };
-
- void FreeSystem (void) {
- MyFreeStructs (&SysRememberKey, systext, syslist);
- }
-
- static struct SystemEntry * genentry(struct SystemEntry **first, struct SystemEntry **previous, int *syscnt)
- {
- struct SystemEntry *sysentry;
-
- if(sysentry = AllocRemember (&SysRememberKey, sizeof (struct SystemEntry), MEMF_ANY|MEMF_CLEAR)) {
- if (! *first)
- *first = sysentry;
- if (*previous)
- (*previous)->syse_next = sysentry;
- (*syscnt)++;
- *previous = sysentry;
- }
- return(sysentry);
- }
-
- STRPTR MyIdHardware(ULONG num)
- {
- return IdHardwareTags(num,IDTAG_Localize,FALSE,TAG_DONE);
- }
- int MyIdCheck(ULONG num)
- {
- return (int)IdHardwareTags(num,IDTAG_NULL4NA,TRUE,TAG_DONE);
- }
-
- int GetSystem (struct SystemEntry **first) {
- struct SystemEntry *sysentry,*previous = NULL;
- int syscnt = 0;
-
- ULONG cacr = GetCACR(); /* 68020..68060 */
- ULONG pcr = GetPCR(); /* 68060 */
- UWORD attn = SysBase->AttnFlags;
-
- *first = 0;
-
- if (clientstate) {
- if (SendDaemon ("GetSysList")) {
- while ((sysentry = AllocRemember (&SysRememberKey, sizeof (struct SystemEntry), MEMF_ANY|MEMF_CLEAR)) \
- && (ReceiveDecodedEntry ((UBYTE *) sysentry, sizeof (struct SystemEntry)))) {
-
- if (! *first)
- *first = sysentry;
- if (previous)
- previous->syse_next = sysentry;
-
- syscnt++;
- previous = sysentry;
- }
- }
- } else if(!IdentifyBase) {
- if(sysentry = genentry(first,&previous,&syscnt)) {
- strcpy (sysentry->syse_line,ESC "8identify.library not available!");
- }
- } else {
- ULONG lastalert;
-
- IdHardwareUpdate(); /* Liste auf dem aktuellsten Stand */
-
- if(sysentry = genentry(first,&previous,&syscnt)) {
- strcpy (sysentry->syse_line,ESC "c" ESC "8-- HARDWARE --");
- }
- genentry(first,&previous,&syscnt);
-
- if(sysentry = genentry(first,&previous,&syscnt)) {
- strcpy (sysentry->syse_desc,"System");
- sprintf(sysentry->syse_line,"%s",IdHardware(IDHW_SYSTEM,NULL));
- }
- genentry(first,&previous,&syscnt);
- if(sysentry = genentry(first,&previous,&syscnt)) {
- strcpy (sysentry->syse_desc,"Processor");
- if(MyIdCheck(IDHW_CPUREV))
- sprintf(sysentry->syse_line,"CPU: %s / %s (ID $%04lx, Rev %s)", MyIdHardware(IDHW_CPU), MyIdHardware(IDHW_CPUCLOCK), pcr>>16, MyIdHardware(IDHW_CPUREV));
- else
- sprintf(sysentry->syse_line,"CPU: %s / %s", MyIdHardware(IDHW_CPU), MyIdHardware(IDHW_CPUCLOCK));
- }
-
- if(MyIdCheck(IDHW_FPU)) {
- if(sysentry = genentry(first,&previous,&syscnt)) {
- sprintf(sysentry->syse_line,"FPU: %s / %s", MyIdHardware(IDHW_FPU), MyIdHardware(IDHW_FPUCLOCK));
- }
- }
-
- if(MyIdCheck(IDHW_MMU)) {
- if(sysentry = genentry(first,&previous,&syscnt)) {
- sprintf(sysentry->syse_line,"MMU: %s", MyIdHardware(IDHW_MMU));
- }
- }
-
- if(MyIdCheck(IDHW_POWERPC)) {
- if(sysentry = genentry(first,&previous,&syscnt)) {
- sprintf(sysentry->syse_line,"PPC: %s / %s", MyIdHardware(IDHW_POWERPC), MyIdHardware(IDHW_PPCCLOCK));
- }
- }
-
- genentry(first,&previous,&syscnt);
- if(sysentry = genentry(first,&previous,&syscnt)) {
- strcpy (sysentry->syse_desc,"Chipset");
- sprintf(sysentry->syse_line,"%s, RamSey %s, Gary %s",MyIdHardware(IDHW_CHIPSET),MyIdHardware(IDHW_RAMSEY),MyIdHardware(IDHW_GARY));
- }
- if(sysentry = genentry(first,&previous,&syscnt)) {
- sprintf(sysentry->syse_line,"ChunkyPlanar %s, BattClock %s",MyIdHardware(IDHW_CHUNKYPLANAR),MyIdHardware(IDHW_BATTCLOCK));
- }
- if(sysentry = genentry(first,&previous,&syscnt)) {
- strcpy (sysentry->syse_desc,"Mother RAM");
- sprintf(sysentry->syse_line,"%s Bit, %s Access, %s CAS, %sx Bandwidth",MyIdHardware(IDHW_RAMWIDTH),MyIdHardware(IDHW_RAMACCESS),MyIdHardware(IDHW_RAMCAS),MyIdHardware(IDHW_RAMBANDWIDTH));
- }
- if(sysentry = genentry(first,&previous,&syscnt)) {
- strcpy (sysentry->syse_desc,"Frequencies");
- sprintf(sysentry->syse_line,"VBlank %s, Power %s, E %s",MyIdHardware(IDHW_VBLANKFREQ),MyIdHardware(IDHW_POWERFREQ),MyIdHardware(IDHW_ECLOCK));
- }
-
- if(attn & AFF_68010) {
- ULONG cache = CacheControl(0,0);
-
- genentry(first,&previous,&syscnt);
- genentry(first,&previous,&syscnt);
- if(sysentry = genentry(first,&previous,&syscnt)) {
- strcpy (sysentry->syse_line,ESC "c" ESC "8-- REGISTERS --");
- }
- genentry(first,&previous,&syscnt);
-
- if(sysentry = genentry(first,&previous,&syscnt)) {
- sprintf(sysentry->syse_line,"VBR $%08lx",GetVBR());
- }
-
- if(attn & AFF_68020)
- {
- if(sysentry = genentry(first,&previous,&syscnt)) {
- sprintf(sysentry->syse_line,"CACR $%08lx",cacr);
- }
- }
-
- if(attn & AFF_68060)
- {
- if(sysentry = genentry(first,&previous,&syscnt)) {
- sprintf(sysentry->syse_line,"PCR $%08lx",pcr);
- }
- }
- genentry(first,&previous,&syscnt);
-
- if(attn & AFF_68020) {
- if(sysentry = genentry(first,&previous,&syscnt)) {
- strcpy(sysentry->syse_desc,"Inst Cache");
- if(cache&CACRF_EnableI){
- strcpy(sysentry->syse_line,"Enabled ");
- if((attn&AFF_68030) && (!(attn&AFF_68040)) && (cache&CACRF_IBE)) strcat(sysentry->syse_line,"Burst ");
- if(cache&CACRF_FreezeI) strcat(sysentry->syse_line,"Frozen ");
- if((attn&AFF_68060) && (cacr&(1<<13))) strcat(sysentry->syse_line,"Half ");
- }else{
- strcpy(sysentry->syse_line,"Disabled");
- }
- }
- }
-
- if(attn & AFF_68030) {
- if(sysentry = genentry(first,&previous,&syscnt)) {
- strcpy(sysentry->syse_desc,"Data Cache");
- if(cache&CACRF_EnableD){
- strcpy(sysentry->syse_line,"Enabled ");
- if((attn&AFF_68030) && (!(attn&AFF_68040)) && (cache&CACRF_DBE)) strcat(sysentry->syse_line,"Burst ");
- if(cache&CACRF_FreezeD) strcat(sysentry->syse_line,"Frozen ");
- if((attn&AFF_68060) && (cacr&(1<<27))) strcat(sysentry->syse_line,"Half ");
- if((attn&AFF_68030) && (!(attn&AFF_68040)) && (cache&CACRF_WriteAllocate)) strcat(sysentry->syse_line,"Allocate ");
- }else{
- strcpy(sysentry->syse_line,"Disabled");
- }
- }
- }
-
- if((attn&AFF_68040) && (!(attn&AFF_68060)) && (cache&CACRF_CopyBack)){
- if(sysentry = genentry(first,&previous,&syscnt)) {
- sprintf(sysentry->syse_line,"CopyBack");
- }
- }
- if(cache&CACRF_EnableE){
- if(sysentry = genentry(first,&previous,&syscnt)) {
- sprintf(sysentry->syse_line,"External Cache");
- }
- }
- if(attn & AFF_68060)
- {
- if(pcr&(1<<0))
- if(sysentry = genentry(first,&previous,&syscnt)) {
- sprintf(sysentry->syse_line,"Superscalar");
- }
- if(cacr&(1<<23))
- if(sysentry = genentry(first,&previous,&syscnt)) {
- sprintf(sysentry->syse_line,"Branch Cache");
- }
- if(cacr&(1<<29))
- if(sysentry = genentry(first,&previous,&syscnt)) {
- sprintf(sysentry->syse_line,"Store Buffer");
- }
- if(cacr&(1<<28))
- if(sysentry = genentry(first,&previous,&syscnt)) {
- sprintf(sysentry->syse_line,"CPUSH invalidation disabled");
- }
- if(pcr&(1<<1))
- if(sysentry = genentry(first,&previous,&syscnt)) {
- sprintf(sysentry->syse_line,"FPU disabled");
- }
- }
- }
-
- genentry(first,&previous,&syscnt);
- genentry(first,&previous,&syscnt);
- if(sysentry = genentry(first,&previous,&syscnt)) {
- strcpy (sysentry->syse_line,ESC "c" ESC "8-- VERSIONS --");
- }
- genentry(first,&previous,&syscnt);
-
- if(sysentry = genentry(first,&previous,&syscnt)) {
- strcpy (sysentry->syse_desc,"AmigaOS");
- sprintf(sysentry->syse_line,"%s (= %s), SetPatch %s, ROM %s",MyIdHardware(IDHW_OSNR),MyIdHardware(IDHW_OSVER),MyIdHardware(IDHW_SETPATCHVER),MyIdHardware(IDHW_ROMSIZE));
- }
- if(sysentry = genentry(first,&previous,&syscnt)) {
- strcpy (sysentry->syse_desc,"Exec");
- sprintf(sysentry->syse_line,"%s",MyIdHardware(IDHW_EXECVER));
- }
- if(sysentry = genentry(first,&previous,&syscnt)) {
- strcpy (sysentry->syse_desc,"Workbench");
- sprintf(sysentry->syse_line,"%s",MyIdHardware(IDHW_WBVER));
- }
- if(sysentry = genentry(first,&previous,&syscnt)) {
- strcpy (sysentry->syse_desc,"Graphics");
- sprintf(sysentry->syse_line,"%s",MyIdHardware(IDHW_GFXSYS));
- }
- if(sysentry = genentry(first,&previous,&syscnt)) {
- strcpy (sysentry->syse_desc,"Audio");
- sprintf(sysentry->syse_line,"%s",MyIdHardware(IDHW_AUDIOSYS));
- }
- if(sysentry = genentry(first,&previous,&syscnt)) {
- strcpy (sysentry->syse_desc,"TCP/IP");
- sprintf(sysentry->syse_line,"%s",MyIdHardware(IDHW_TCPIP));
- }
- if(sysentry = genentry(first,&previous,&syscnt)) {
- strcpy (sysentry->syse_desc,"PowerPC-OS");
- sprintf(sysentry->syse_line,"%s",MyIdHardware(IDHW_PPCOS));
- }
-
- genentry(first,&previous,&syscnt);
- genentry(first,&previous,&syscnt);
- if(sysentry = genentry(first,&previous,&syscnt)) {
- strcpy (sysentry->syse_line,ESC "c" ESC "8-- MEMORY --");
- }
- genentry(first,&previous,&syscnt);
- if(sysentry = genentry(first,&previous,&syscnt)) {
- sprintf(sysentry->syse_line," Chip Fast TOTAL");
- }
- if(sysentry = genentry(first,&previous,&syscnt)) {
- strcpy (sysentry->syse_desc,"Plain");
- sprintf(sysentry->syse_line,"%9s %9s %9s",MyIdHardware(IDHW_PLNCHIPRAM),MyIdHardware(IDHW_PLNFASTRAM),MyIdHardware(IDHW_PLNRAM));
- }
- if(sysentry = genentry(first,&previous,&syscnt)) {
- strcpy (sysentry->syse_desc,"Virtual");
- sprintf(sysentry->syse_line,"%9s %9s %9s",MyIdHardware(IDHW_VMMCHIPRAM),MyIdHardware(IDHW_VMMFASTRAM),MyIdHardware(IDHW_VMMRAM));
- }
- if(sysentry = genentry(first,&previous,&syscnt)) {
- strcpy (sysentry->syse_desc,"TOTAL");
- sprintf(sysentry->syse_line,"%9s %9s %9s",MyIdHardware(IDHW_CHIPRAM),MyIdHardware(IDHW_FASTRAM),MyIdHardware(IDHW_RAM));
- }
- genentry(first,&previous,&syscnt);
- if(sysentry = genentry(first,&previous,&syscnt)) {
- sprintf(sysentry->syse_line,"SlowRAM: %s",MyIdHardware(IDHW_SLOWRAM));
- }
-
- lastalert = IdHardwareNum(IDHW_LASTALERT,NULL);
- if(lastalert != 0xFFFFFFFF) {
- genentry(first,&previous,&syscnt);
- genentry(first,&previous,&syscnt);
- if(sysentry = genentry(first,&previous,&syscnt)) {
- strcpy (sysentry->syse_line,ESC "c" ESC "8-- LAST ALERT --");
- }
- genentry(first,&previous,&syscnt);
- if(sysentry = genentry(first,&previous,&syscnt)) {
- strcpy (sysentry->syse_desc,"Alert Code");
- sprintf(sysentry->syse_line,"%08lx",lastalert);
- }
- if(sysentry = genentry(first,&previous,&syscnt)) {
- strcpy (sysentry->syse_desc,"Deadend");
- IdAlertTags(lastalert,IDTAG_DeadStr,sysentry->syse_line,TAG_DONE);
- }
- if(sysentry = genentry(first,&previous,&syscnt)) {
- strcpy (sysentry->syse_desc,"Sub System");
- IdAlertTags(lastalert,IDTAG_SubsysStr,sysentry->syse_line,TAG_DONE);
- }
- if(sysentry = genentry(first,&previous,&syscnt)) {
- strcpy (sysentry->syse_desc,"General");
- IdAlertTags(lastalert,IDTAG_GeneralStr,sysentry->syse_line,TAG_DONE);
- }
- if(sysentry = genentry(first,&previous,&syscnt)) {
- strcpy (sysentry->syse_desc,"Specific");
- IdAlertTags(lastalert,IDTAG_SpecStr,sysentry->syse_line,TAG_DONE);
- }
- }
- }
- return (syscnt);
- }
-
- void PrintSystem (char *filename) {
- int i=1;
- BPTR handle;
- struct SystemEntry *entryp;
- STRPTR desc,line;
-
- handle = HandlePrintStart (filename);
- if (handle) {
- if (! WI_System) {
- i = GetSystem (&entryp);
- }
- if (i) {
- for (i=0;;i++) {
- if (WI_System)
- DoMethod (syslist,MUIM_List_GetEntry,i,&entryp);
- if (!entryp) break;
-
- desc = entryp->syse_desc; while(*desc=='\33') desc+=2;
- line = entryp->syse_line; while(*line=='\33') line+=2;
-
- sprintf (tmpstr2, " %15ls %ls\n",desc,line);
- if (! (PrintOneLine (handle, tmpstr2)))
- break;
-
- if (! WI_System)
- entryp = entryp->syse_next;
- }
- }
- }
- HandlePrintStop();
- }
-
- void ShowSystem (void) {
- struct SystemEntry *syse;
-
- ApplicationSleep();
- set (syslist,MUIA_List_Quiet,TRUE);
-
- FreeSystem();
- GetSystem(&syse);
-
- while (syse) {
- InsertBottomEntry (syslist, (APTR *) &syse);
- syse = syse->syse_next;
- }
-
- AwakeApplication();
- set (syslist,MUIA_List_Quiet,FALSE);
- }
-
- void SendSystemList (void) {
- struct SystemEntry *syse;
-
- FreeSystem();
- GetSystem (&syse);
-
- while (syse) {
- SendEncodedEntry ((UBYTE *) syse, sizeof (struct SystemEntry));
- syse = syse->syse_next;
- }
- FreeSystem();
- }
-
-
- /*********************************************************************
- *********************************************************************/
-
- __asm int priority_callfunc(register __a1 char **contents) {
- unsigned char *pristring;
- int pri=0,length;
-
- get (pritext3,MUIA_String_Contents,&pristring);
-
- if (((length = stcd_i (pristring,&pri)) == strlen (pristring)) && \
- (pri >= -128) && (pri <= 127)) {
- set (SL_Priority,MUIA_Slider_Level,pri);
- set (WI_Priority,MUIA_Window_ActiveObject,BT_PriorityOK);
- } else {
- set (WI_Priority,MUIA_Window_ActiveObject,pritext3);
- }
-
- return (pri);
- }
-
- struct Hook priority_callhook = {
- {NULL, NULL},
- (ULONG (* )())priority_callfunc,
- NULL, NULL
- };
-
- BOOL GetPriority (char *nodename, char *pritext, LONG *pri) {
- BOOL running = TRUE, result = FALSE;
- LONG oldpri;
- ULONG signal;
-
- IsDec (pritext, &oldpri);
-
- WI_Priority = WindowObject,
-
- MUIA_Window_Title, "SCOUT: Change priority",
- MUIA_Window_ID, MakeID('P','R','I','O'),
- WindowContents, VGroup,
- Child, MyVSpace(2),
- Child, pritext1 = MyTextObject(),
- Child, MyVSpace(2),
- Child, SL_Priority = SliderObject,
- MUIA_Slider_Min, -128,
- MUIA_Slider_Max, 127,
- MUIA_Slider_Level, 0,
- MUIA_Slider_Quiet, TRUE,
- MUIA_FixHeightTxt, " ",
- End,
- Child, MyVSpace(2),
- Child, HGroup, MUIA_Group_SameWidth, TRUE,
- Child, HGroup,
- Child, MyLabel2 ("Min:"),
- Child, MyTextObject3(ESC "c -128 "),
- End,
- Child, HGroup,
- Child, MyLabel2 ("Max:"),
- Child, MyTextObject3(ESC "c127"),
- End,
- Child, HGroup,
- Child, MyLabel2 ("Old:"),
- Child, pritext2 = MyTextObject(),
- End,
- Child, HGroup,
- Child, MyLabel2 ("New:"),
- Child, pritext3 = StringObject,
- MUIA_String_BufferPos, 1,
- MUIA_String_Accept , "-0123456879",
- MUIA_String_Integer, oldpri,
- MUIA_String_MaxLen, 5, StringFrame,
- End,
- End,
- End,
- Child, MyVSpace(2),
- Child, HGroup, MUIA_Group_SameWidth, TRUE,
- Child, BT_PriorityOK = KeyButtonA (OKText ,ID_PRIORITYOK),
- Child, BT_PriorityCancel = KeyButtonA (CancelText,ID_PRIORITYEXIT),
- End,
- End, End;
-
- if (WI_Priority) {
- MySetContents (pritext1, ESC "c Please select a new priority for \n'%s'! ", nodename);
- MySetContents (pritext2, ESC "c%d",oldpri);
- set (SL_Priority,MUIA_Slider_Level,oldpri);
- set (pritext3,MUIA_Text_Contents,tmpstr);
-
- ApplicationSleep();
-
- DoMethod (AP_Scout,OM_ADDMEMBER,WI_Priority);
- DoMethod (WI_Priority,MUIM_Window_SetCycleChain,SL_Priority,pritext3,BT_PriorityCancel,BT_PriorityOK,NULL);
- SetCloseRequest (WI_Priority,(int) ID_PRIORITYEXIT);
-
- DoMethod (SL_Priority,MUIM_Notify,MUIA_Slider_Level,MUIV_EveryTime,pritext3,4,MUIM_SetAsString,MUIA_String_Contents,"%ld",MUIV_TriggerValue);
- DoMethod (pritext3,MUIM_Notify,MUIA_String_Acknowledge,MUIV_EveryTime,pritext3,3,MUIM_CallHook,&priority_callhook,MUIV_TriggerValue);
-
- SetWindowOpen (WI_Priority,SL_Priority,NULL);
-
- while (running) {
- switch (DoMethod(AP_Scout,MUIM_Application_Input,&signal)) {
- case ID_PRIORITYOK:
- get (SL_Priority,MUIA_Slider_Level,pri);
- result = TRUE;
- running = FALSE;
- break;
-
- case ID_PRIORITYEXIT:
- running = FALSE;
- break;
-
- default:
- break;
- }
- if (running && signal)
- Wait (signal);
- }
-
- SetWindowClose (WI_Priority,FALSE);
- AwakeApplication();
-
- DoMethod (AP_Scout,OM_REMMEMBER,WI_Priority);
- MUI_DisposeObject (WI_Priority);
- WI_Priority = NULL;
- }
- return (result);
- }
-
- BOOL GetSignal (char *taskname, char *waitsignal, char *resultstring) {
- BOOL running = TRUE, result = FALSE;
- LONG signal;
- char *textptr;
-
- WI_Signal = WindowObject,
-
- MUIA_Window_Title, "SCOUT: Send signal",
- MUIA_Window_ID, MakeID('S','E','N','D'),
- WindowContents, VGroup,
- Child, MyVSpace(2),
- Child, sigtext1 = MyTextObject(),
- Child, MyVSpace(2),
- Child, HGroup, MUIA_Group_SameWidth, TRUE,
- Child, HGroup,
- Child, KeyLabel("Signal:", 's'),
- Child, sigtext2 = StringObject,
- MUIA_ControlChar, 's',
- MUIA_String_MaxLen, 10, StringFrame,
- MUIA_String_EditHook, &hexstring_edithook,
- End,
- End,
- Child, HGroup,
- Child, MyLabel ("SigWait:"),
- Child, sigtext3 = MyTextObject(),
- End,
- End,
- Child, MyVSpace(2),
- Child, HGroup, MUIA_Group_SameWidth, TRUE,
- Child, BT_SignalOK = KeyButtonA (OKText ,ID_SIGNALOK),
- Child, BT_SignalCancel = KeyButtonA (CancelText,ID_SIGNALEXIT),
- End,
- End, End;
-
- if (WI_Signal) {
- MySetContents (sigtext1, ESC "c Please select the signal for \n'%ls'! ", taskname);
- set (sigtext2, MUIA_String_Contents, waitsignal);
- MySetContents (sigtext3, ESC "c%ls", waitsignal);
-
- ApplicationSleep();
-
- DoMethod (AP_Scout,OM_ADDMEMBER,WI_Signal);
- DoMethod (WI_Signal,MUIM_Window_SetCycleChain,sigtext2,BT_SignalOK,BT_SignalCancel,NULL);
- SetCloseRequest (WI_Signal,(int) ID_SIGNALEXIT);
-
- SetWindowOpen (WI_Signal,sigtext2,NULL);
-
- while (running) {
- switch (DoMethod(AP_Scout,MUIM_Application_Input,&signal)) {
- case ID_SIGNALOK:
- get (sigtext2,MUIA_String_Contents,&textptr);
- strcpy (resultstring, textptr);
- running = FALSE;
- result = TRUE;
- break;
-
- case ID_SIGNALEXIT:
- running = FALSE;
- break;
-
- default:
- break;
- }
- if (running && signal)
- Wait (signal);
- }
-
- SetWindowClose (WI_Signal,FALSE);
- AwakeApplication();
-
- DoMethod (AP_Scout,OM_REMMEMBER,WI_Signal);
- MUI_DisposeObject (WI_Signal);
- WI_Signal = NULL;
- }
- return (result);
- }
-
- /*********************************************************************
- LowMemory
- *********************************************************************/
- struct LowMemoryEntry {
- struct LowMemoryEntry *lowmemory_next;
- struct Interrupt *lowmemory_adr;
- char lowmemory_address[10];
- char lowmemory_name[NODENAMELENGTH+2];
- char lowmemory_type[NODETYPELEN+1];
- char lowmemory_pri[10];
- char lowmemory_data[10];
- char lowmemory_code[20];
- };
-
- __asm LONG lowmemorylist_dspfunc(register __a2 char **array, register __a1 struct LowMemoryEntry *lowmemoryentry, register __a0 struct Hook *hook) {
- if (lowmemoryentry) {
- *array++ = lowmemoryentry->lowmemory_address;
- *array++ = lowmemoryentry->lowmemory_name;
- *array++ = lowmemoryentry->lowmemory_type;
- *array++ = lowmemoryentry->lowmemory_pri;
- *array++ = lowmemoryentry->lowmemory_data;
- *array++ = lowmemoryentry->lowmemory_code;
- *array = NULL;
- } else {
- *array++ = ESC "bAddress";
- *array++ = ESC "bln_Name";
- *array++ = ESC "bln_Type";
- *array++ = ESC "bln_Pri";
- *array++ = ESC "bis_Data";
- *array++ = ESC "bis_Code";
- *array++ = NULL;
- }
- return(0);
- }
-
- struct Hook lowmemorylist_dsphook = {
- {NULL, NULL},
- (ULONG (* )())lowmemorylist_dspfunc,
- NULL, NULL
- };
-
- void FreeLowMemory (void) {
- MyFreeStructs (&LowMemoryRememberKey, lowmemorytext, lowmemorylist);
- }
-
- int GetLowMemory (struct LowMemoryEntry **first) {
- struct Interrupt *intr;
- struct LowMemoryEntry *lowmemoryentry,*previous = NULL;
- char code[FILENAMELENGTH + 1];
-
- int lowmemorycnt = 0;
- *first = 0;
-
- if (clientstate) {
- if (SendDaemon ("GetLowMemList")) {
- while ((lowmemoryentry = AllocRemember (&LowMemoryRememberKey, sizeof (struct LowMemoryEntry), MEMF_ANY|MEMF_CLEAR)) \
- && (ReceiveDecodedEntry ((UBYTE *) lowmemoryentry, sizeof (struct LowMemoryEntry)))) {
- IsHex (lowmemoryentry->lowmemory_address, (long *) &lowmemoryentry->lowmemory_adr);
-
- if (! *first)
- *first = lowmemoryentry;
- if (previous)
- previous->lowmemory_next = lowmemoryentry;
-
- lowmemorycnt++;
- previous = lowmemoryentry;
- }
- }
- } else {
- if (SysBase->LibNode.lib_Version >= 39) {
- if (intr = (struct Interrupt *)SysBase->ex_MemHandlers.mlh_Head) {
- while ((intr->is_Node.ln_Succ != 0) && (lowmemoryentry = AllocRemember (&LowMemoryRememberKey, sizeof (struct LowMemoryEntry), MEMF_ANY|MEMF_CLEAR))) {
- if (! *first)
- *first = lowmemoryentry;
- if (previous)
- previous->lowmemory_next = lowmemoryentry;
-
- lowmemoryentry->lowmemory_adr = intr;
-
- code[0] = '\0';
- if (points2ram((APTR) intr->is_Code)) {
- sprintf (code, HELL "$%08x" DUNKEL, intr->is_Code);
- } else {
- sprintf (code, "$%08x", intr->is_Code);
- }
- sprintf (lowmemoryentry->lowmemory_address, "$%08x", intr);
- strncpy (lowmemoryentry->lowmemory_name, nonetest (intr->is_Node.ln_Name), 27);
- strcpy (lowmemoryentry->lowmemory_type, GetNodeType (intr->is_Node.ln_Type));
- sprintf (lowmemoryentry->lowmemory_pri, "%4d ", intr->is_Node.ln_Pri);
- sprintf (lowmemoryentry->lowmemory_data, "$%08x", intr->is_Data);
- strcpy (lowmemoryentry->lowmemory_code, code);
- lowmemorycnt++;
-
- previous = lowmemoryentry;
- intr = (struct Interrupt *) intr->is_Node.ln_Succ;
- }
- }
- }
- }
- return (lowmemorycnt);
- }
-
- void PrintLowMemory (char *filename) {
- int i=1;
- BPTR handle;
- struct LowMemoryEntry *entryp;
-
- handle = HandlePrintStart (filename);
- if ((handle) && (PrintOneLine (handle, "\n Address Type Pri Data Code Name\n\n"))) {
- if (! WI_LowMemory) {
- i = GetLowMemory (&entryp);
- }
- if (i) {
- for (i=0;;i++) {
- if (WI_LowMemory)
- DoMethod (lowmemorylist,MUIM_List_GetEntry,i,&entryp);
- if (!entryp) break;
-
- if (points2ram ((APTR) (entryp->lowmemory_adr->is_Code)))
- strcpy (tmpstr, entryp->lowmemory_code+2);
- else
- strcpy (tmpstr, entryp->lowmemory_code);
-
- sprintf (tmpstr2, " %ls %-9ls %4ls %ls %-9.9ls %ls\n", entryp->lowmemory_address, entryp->lowmemory_type, entryp->lowmemory_pri, entryp->lowmemory_data, tmpstr, entryp->lowmemory_name);
- if (! (PrintOneLine (handle, tmpstr2)))
- break;
-
- if (! WI_LowMemory)
- entryp = entryp->lowmemory_next;
- }
- }
- }
- HandlePrintStop();
- }
-
- void ShowLowMemory (void) {
- struct LowMemoryEntry *lowmemory;
-
- ApplicationSleep();
- set (lowmemorylist,MUIA_List_Quiet,TRUE);
- //* set (BT_LowMemoryCause, MUIA_Disabled, TRUE);
- set (BT_LowMemoryRemove, MUIA_Disabled, TRUE);
- set (BT_LowMemoryPriority, MUIA_Disabled, TRUE);
-
- FreeLowMemory();
- lowmemorycnt = GetLowMemory (&lowmemory);
-
- while (lowmemory) {
- InsertBottomEntry (lowmemorylist, (APTR *) &lowmemory);
- lowmemory = lowmemory->lowmemory_next;
- }
-
- SetCountText (lowmemorycount, lowmemorycnt);
- AwakeApplication();
- set (lowmemorylist,MUIA_List_Quiet,FALSE);
- }
-
- void SendLowMemory (void) {
- struct LowMemoryEntry *lowmemory;
-
- FreeLowMemory();
- lowmemorycnt = GetLowMemory (&lowmemory);
-
- while (lowmemory) {
- SendEncodedEntry ((UBYTE *) lowmemory, sizeof (struct LowMemoryEntry));
- lowmemory = lowmemory->lowmemory_next;
- }
- FreeLowMemory();
- }
-
- /*********************************************************************
- Timer
- *********************************************************************/
- struct TimerEntry {
- struct TimerEntry *timer_next;
- struct timerequest *timer_adr;
- char timer_address[10];
- char timer_name[NODENAMELENGTH+2];
- char timer_replyport[10];
- char timer_unit[20];
- char timer_timeout[20];
- };
-
- __asm LONG timerlist_dspfunc(register __a2 char **array, register __a1 struct TimerEntry *timerentry, register __a0 struct Hook *hook) {
- if (timerentry) {
- *array++ = timerentry->timer_address;
- *array++ = timerentry->timer_replyport;
- *array++ = timerentry->timer_timeout;
- *array++ = timerentry->timer_unit;
- *array = timerentry->timer_name;
- } else {
- *array++ = ESC "bAddress";
- *array++ = ESC "bReplyPort";
- *array++ = ESC "bTime";
- *array++ = ESC "bUnit";
- *array = ESC "bTask";
- }
- return(0);
- }
-
- struct Hook timerlist_dsphook = {
- {NULL, NULL},
- (ULONG (* )())timerlist_dspfunc,
- NULL, NULL
- };
-
- void FreeTimer (void) {
- MyFreeStructs (&TimerRememberKey, timertext, timerlist);
- }
-
- int GetTimer (struct TimerEntry **first) {
- struct timerequest *tr;
- struct timerequest *search;
- struct MsgPort *mp;
- struct TimerEntry *timerentry,*previous = NULL;
- char code[FILENAMELENGTH + 1];
- ULONG time, eclk, std, min, sec;
- struct EClockVal eclock;
-
- int timercnt = 0;
- *first = 0;
-
- if (clientstate) {
- if (SendDaemon ("GetTimerList")) {
- while ((timerentry = AllocRemember (&TimerRememberKey, sizeof (struct TimerEntry), MEMF_ANY|MEMF_CLEAR)) \
- && (ReceiveDecodedEntry ((UBYTE *) timerentry, sizeof (struct TimerEntry)))) {
- IsHex (timerentry->timer_address, (long *) &timerentry->timer_adr);
-
- if (! *first)
- *first = timerentry;
- if (previous)
- previous->timer_next = timerentry;
-
- timercnt++;
- previous = timerentry;
- }
- }
- } else {
- if (mp = CreateMsgPort()) {
- if (tr = CreateIORequest(mp,sizeof(struct timerequest))) {
- if (!OpenDevice("timer.device",UNIT_MICROHZ,(struct IORequest *)tr,0)) {
- TimerBase = (struct Library *)tr->tr_node.io_Device;
- tr->tr_node.io_Command = TR_ADDREQUEST;
- tr->tr_time.tv_secs = 0;
- tr->tr_time.tv_micro = 10000; /* 10ms */
- Forbid();
- SendIO((struct IORequest *)tr);
- for(search = tr;
- search->tr_node.io_Message.mn_Node.ln_Pred;
- search = (struct timerequest *)search->tr_node.io_Message.mn_Node.ln_Pred);
-
- eclk = ReadEClock(&eclock);
- eclk /= 100;
-
- search = (struct timerequest *) search->tr_node.io_Message.mn_Node.ln_Succ;
- while (search->tr_node.io_Message.mn_Node.ln_Succ != 0) {
- if (search!=tr) {
- if (!(timerentry = AllocRemember (&TimerRememberKey, sizeof (struct TimerEntry), MEMF_ANY|MEMF_CLEAR))) break;
- if (! *first)
- *first = timerentry;
- if (previous)
- previous->timer_next = timerentry;
-
- time = search->tr_time.tv_micro;
- if(time > eclock.ev_lo)
- time -= eclock.ev_lo;
- else
- time = 0;
- time /= eclk;
-
- sec = search->tr_time.tv_secs + (time/100);
- min = sec/60; sec %= 60;
- std = min/60; min %= 60;
-
- timerentry->timer_adr = search;
- sprintf (timerentry->timer_address, "$%08x", search);
- strncpy (timerentry->timer_name, nonetest (((struct Node *)search->tr_node.io_Message.mn_ReplyPort->mp_SigTask)->ln_Name), 27);
- sprintf (timerentry->timer_replyport, "$%08x", search->tr_node.io_Message.mn_ReplyPort);
- strcpy (timerentry->timer_unit, "MicroHz");
- sprintf (timerentry->timer_timeout, "%ld:%02ld'%02ld.%02ld\"", std, min, sec, time%100);
- timercnt++;
-
- previous = timerentry;
- }
- search = (struct timerequest *) search->tr_node.io_Message.mn_Node.ln_Succ;
- }
- Permit();
- WaitIO((struct IORequest *)tr);
- CloseDevice((struct IORequest *)tr);
- }
- if (!OpenDevice("timer.device",UNIT_VBLANK,(struct IORequest *)tr,0)) {
- TimerBase = (struct Library *)tr->tr_node.io_Device;
- tr->tr_node.io_Command = TR_ADDREQUEST;
- tr->tr_time.tv_secs = 0;
- tr->tr_time.tv_micro = 20000; /* 20ms */
- Forbid();
- SendIO((struct IORequest *)tr);
- for(search = tr;
- search->tr_node.io_Message.mn_Node.ln_Pred;
- search = (struct timerequest *)search->tr_node.io_Message.mn_Node.ln_Pred);
-
- eclk = ReadEClock(&eclock);
-
- search = (struct timerequest *) search->tr_node.io_Message.mn_Node.ln_Succ;
- while (search->tr_node.io_Message.mn_Node.ln_Succ != 0) {
- if (search!=tr) {
- if (!(timerentry = AllocRemember (&TimerRememberKey, sizeof (struct TimerEntry), MEMF_ANY|MEMF_CLEAR))) break;
- if (! *first)
- *first = timerentry;
- if (previous)
- previous->timer_next = timerentry;
-
- time = search->tr_time.tv_micro;
-
- if(time > eclock.ev_lo)
- time = ((time-eclock.ev_lo)*100)/eclk;
- else
- time = 0;
-
- sec = search->tr_time.tv_secs + (time/100);
- min = sec/60; sec %= 60;
- std = min/60; min %= 60;
-
- timerentry->timer_adr = search;
- sprintf (timerentry->timer_address, "$%08x", search);
- strncpy (timerentry->timer_name, nonetest (((struct Node *)search->tr_node.io_Message.mn_ReplyPort->mp_SigTask)->ln_Name), 27);
- sprintf (timerentry->timer_replyport, "$%08x", search->tr_node.io_Message.mn_ReplyPort);
- strcpy (timerentry->timer_unit, "VBlank");
- sprintf (timerentry->timer_timeout, "%ld:%02ld'%02ld.%02ld\"", std, min, sec, time%100);
- timercnt++;
-
- previous = timerentry;
- }
- search = (struct timerequest *) search->tr_node.io_Message.mn_Node.ln_Succ;
- }
- Permit();
- WaitIO((struct IORequest *)tr);
- CloseDevice((struct IORequest *)tr);
- }
- DeleteIORequest((struct IORequest *)tr);
- }
- DeleteMsgPort(mp);
- }
- }
- return (timercnt);
- }
-
- void PrintTimer (char *filename) {
- int i=1;
- BPTR handle;
- struct TimerEntry *entryp;
-
- handle = HandlePrintStart (filename);
- if ((handle) && (PrintOneLine (handle, "\n Address ReplyPort Time Unit Name\n\n"))) {
- if (! WI_Timer) {
- i = GetTimer (&entryp);
- }
- if (i) {
- for (i=0;;i++) {
- if (WI_Timer)
- DoMethod (timerlist,MUIM_List_GetEntry,i,&entryp);
- if (!entryp) break;
-
- sprintf (tmpstr2, " %ls %ls %13ls %7ls %ls\n", entryp->timer_address, entryp->timer_replyport, entryp->timer_timeout, entryp->timer_unit, entryp->timer_name);
- if (! (PrintOneLine (handle, tmpstr2)))
- break;
-
- if (! WI_Timer)
- entryp = entryp->timer_next;
- }
- }
- }
- HandlePrintStop();
- }
-
- void ShowTimer (void) {
- struct TimerEntry *timer;
-
- ApplicationSleep();
- set (timerlist,MUIA_List_Quiet,TRUE);
- //* set (BT_TimerRemove, MUIA_Disabled, TRUE);
-
- FreeTimer();
- timercnt = GetTimer (&timer);
-
- while (timer) {
- InsertBottomEntry (timerlist, (APTR *) &timer);
- timer = timer->timer_next;
- }
-
- DoMethod(timerlist,MUIM_List_Sort);
-
- SetCountText (timercount, timercnt);
- AwakeApplication();
- set (timerlist,MUIA_List_Quiet,FALSE);
- }
-
- void SendTimerList (void) {
- struct TimerEntry *timer;
-
- FreeTimer();
- timercnt = GetTimer (&timer);
-
- while (timer) {
- SendEncodedEntry ((UBYTE *) timer, sizeof (struct TimerEntry));
- timer = timer->timer_next;
- }
- FreeTimer();
- }
-
-
- /*********************************************************************
- BEGIN: MAIN
- *********************************************************************/
-
- __asm ULONG main (register __a0 struct WBStartup *msg) {
- BOOL RETURN_FLAG = FALSE;
- ULONG RETURN_CODE = RETURN_OK;
- struct Library *miamilib = NULL;
- int i;
-
- if (! init1()) {
- fail1();
- return (RETURN_FAIL);
- }
-
- if ((opts.User || opts.Password) && (! opts.Host)) {
- aprintf ("You didn't specify the HOST!\n");
- RETURN_CODE = RETURN_FAIL;
- RETURN_FLAG = TRUE;
-
- } else if (opts.Host) {
- Forbid();
- if ( FindPort ("AMITCP")
- ||(miamilib = OpenLibrary("miami.library",0L))) {
- Permit();
- if(miamilib) CloseLibrary(miamilib);
- if (opts.Command) {
- RETURN_CODE = netshellclient();
- RETURN_FLAG = TRUE;
- } else if (! (clientstate = ConnectToServer())) {
- RETURN_CODE = RETURN_FAIL;
- RETURN_FLAG = TRUE;
- }
- } else {
- Permit();
- aprintf ("You have to start AmiTCP 4.0+ first!\n");
- RETURN_CODE = RETURN_FAIL;
- RETURN_FLAG = TRUE;
- }
-
- } else if (opts.Command) {
- shellstate = TRUE;
- RETURN_CODE = ExecuteCommand (opts.Command);
- RETURN_FLAG = TRUE;
-
- } else {
- Forbid();
- if (FindPort ("AMITCP") && isNetCall()) {
- Permit();
- RETURN_CODE = netdaemon();
- RETURN_FLAG = TRUE;
- } else {
- Permit();
- }
- }
-
- if (RETURN_FLAG) {
- fail1();
- return (RETURN_CODE);
- }
-
- if (! init2()) {
- fail();
- return (RETURN_FAIL);
- }
-
- if ((opts.CpuDisplay) && (! clientstate)) {
- updatetimestate = (ULONG) *opts.CpuDisplay;
- }
-
- if (opts.SortLibrariesType)
- libsortstate = *opts.SortLibrariesType;
- liblist_cmphook_ptr = LibSortList[libsortstate];
-
- if (opts.SortDevicesType)
- devsortstate = *opts.SortDevicesType;
- devlist_cmphook_ptr = LibSortList[devsortstate];
-
- if (opts.SortResourcesType)
- ressortstate = *opts.SortResourcesType;
- reslist_cmphook_ptr = LibSortList[ressortstate];
-
- if (opts.SortTasksType)
- tasksortstate = *opts.SortTasksType;
- tasklist_cmphook_ptr = TaskSortList[tasksortstate];
-
- if (opts.SortPortsType)
- portsortstate = *opts.SortPortsType;
- portlist_cmphook_ptr = PortSortList[portsortstate];
-
- if (opts.SortCommandsType)
- comsortstate = *opts.SortCommandsType;
- comlist_cmphook_ptr = ComSortList[comsortstate];
-
- if (opts.SortAssignsType)
- asssortstate = *opts.SortAssignsType;
- asslist_cmphook_ptr = AssSortList[asssortstate];
-
- if (opts.SortLocksType)
- locksortstate = *opts.SortLocksType;
- locklist_cmphook_ptr = LockSortList[locksortstate];
-
- if (opts.SortCommoditiesType)
- cxsortstate = *opts.SortCommoditiesType;
- cxlist_cmphook_ptr = CxSortList[cxsortstate];
-
- if (opts.SortClassesType)
- classsortstate = *opts.SortClassesType;
- classlist_cmphook_ptr = ClassSortList[classsortstate];
-
- if (opts.SortScreenmodeType)
- smodesortstate = *opts.SortScreenmodeType;
- smodelist_cmphook_ptr = SModeSortList[smodesortstate];
-
- if ((opts.IntervalTime) && (IsReal (opts.IntervalTime))) {
- if (strlen (opts.IntervalTime) <= 6) {
- cpuinterval_callfunc (&opts.IntervalTime);
- strcpy (updatetimetext, opts.IntervalTime);
- }
- }
-
- if (! GetApplication()) {
- aprintf ("Failed to create application!\n");
- fail();
- return (RETURN_FAIL);
- }
-
- Forbid();
- if (portname = FindMyARexxPort ("SCOUT")) {
- myarexxport = FindPort (portname);
- } else {
- portname = " < ERROR > ";
- myarexxport = NULL;
- }
-
- if ((opts.PortName) && (myarexxport)) {
- portname = opts.PortName;
- myarexxport->mp_Node.ln_Name = opts.PortName;
- }
- Permit();
-
- if (opts.Iconified) {
- set (AP_Scout, MUIA_Application_Iconified, TRUE);
- }
- /*
- ** Everything's ready, lets launch the application. We will
- ** open the master window now at this old position.
- */
-
- DoMethod (AP_Scout,MUIM_Application_Load,MUIV_Application_Load_ENV);
-
- SetWindowOpen (WI_Main,NULL,NULL);
-
- /*
- ** Now the ARexx startup script will be started. Herewith it's
- ** possible to open window at the beginning.
- */
-
- if (opts.Startup) {
- BPTR startuplock;
- if (startuplock = Lock (opts.Startup, ACCESS_READ)) {
- UnLock (startuplock);
- if (! SendStartupMsg ("REXX", opts.Startup, TRUE))
- aprintf ("Failed to send port 'REXX' scriptname '%ls'!\n", opts.Startup);
- } else {
- if (! SendStartupMsg (myarexxport->mp_Node.ln_Name, opts.Startup, FALSE))
- aprintf ("Failed to send port '%ls' message \"%ls\"!\n", myarexxport->mp_Node.ln_Name, opts.Startup);
- }
- }
-
- /*
- ** This is the main loop. As you can see, it does just nothing.
- ** Everything is handled by MUI, no work for the programmer.
- */
-
- {
- BOOL running = TRUE;
- LONG pos, id; // für MultipleLockSelect
- ULONG signal, received;
- STRPTR cxhelp;
- struct ListEntry *entryp = 0;
- struct Task *tmptask;
- struct Node *node;
- ULONG reid;
-
- while (running) {
- reid = DoMethod(AP_Scout,MUIM_Application_Input,&signal);
- if(reid==MUIV_Application_ReturnID_Quit)
- running = FALSE;
-
- else if((reid>ID_FIRSTID) && (reid<ID_LASTID)) switch (reid) {
- case ID_LIBPRINT:
- PrintLibraries (NULL);
- break;
-
- case ID_LIBRARIES:
- case ID_LIBUPDATE:
- LibrariesWindow (TRUE);
- break;
-
- case ID_LIBREMOVE:
- if (entryp = GetActiveEntry (liblist)) {
- if (MyRequest ("Yes|No", "Do you really want to remove\n'%ls'?", ((struct LibEntry *) entryp)->lib_name)) {
- MyDoCommand ("RemoveLibrary \"%ls\"", ((struct LibEntry *) entryp)->lib_name);
- ShowLibraries ();
- }
- }
- break;
-
- case ID_LIBCLOSE:
- if (entryp = GetActiveEntry (liblist)) {
- int tmpint;
- long tmplong;
-
- if ((IsDec (((struct LibEntry *) entryp)->lib_ocnt, &tmplong)) && (tmplong)) {
- if (tmpint = MyRequest ("Once|All|Cancel", "Do you really want to close\n '%ls'?", ((struct LibEntry *) entryp)->lib_name)) {
- if (tmpint == 1) {
- MyDoCommand ("CloseLibrary \"%ls\"", ((struct LibEntry *) entryp)->lib_name);
- tmplong--;
- } else {
- while (tmplong) {
- if (! MyDoCommand ("CloseLibrary \"%ls\"", ((struct LibEntry *) entryp)->lib_name)) {
- break;
- }
- tmplong--;
- }
- }
- sprintf (((struct LibEntry *) entryp)->lib_ocnt, "%3d ", tmplong);
- RedrawActiveEntry (liblist);
- }
- } else {
- MyRequest ("Continue", "The OpenCount of \'%ls\' is already zero!", ((struct LibEntry *) entryp)->lib_name);
- }
- }
- break;
-
- case ID_LIBPRIORITY:
- if (entryp = GetActiveEntry (liblist)) {
- LONG tmppri;
-
- if (GetPriority (((struct LibEntry *) entryp)->lib_name, ((struct LibEntry *) entryp)->lib_pri, &tmppri)) {
- if (MyDoCommand ("SetPriority LIBRARY \"%ls\" %ld", ((struct LibEntry *) entryp)->lib_name, tmppri)) {
- sprintf (((struct LibEntry *) entryp)->lib_pri, "%4d ", tmppri);
- }
- ShowLibraries ();
- }
- }
- break;
-
- case ID_LIBFUNCTIONS:
- if (node = HandleNodeDetails (liblist, "library"))
- GetLDRFctList ((struct Library *) node,'L');
- break;
-
- case ID_LIBMORE:
- if (node = HandleNodeDetails (liblist, "library"))
- GetLibMore ((struct Library *) node);
- break;
-
- case ID_LIBEXIT:
- LibrariesWindow (FALSE);
- break;
-
- case ID_LIBLV_ACTIVE:
- if (entryp = GetActiveEntry (liblist)) {
- MySetContents (libtext, "%ls \"%-.30s\"", ((struct LibEntry *) entryp)->lib_address, ((struct LibEntry *) entryp)->lib_name);
-
- set (BT_LibRemove, MUIA_Disabled, FALSE);
- set (BT_LibClose, MUIA_Disabled, FALSE);
- set (BT_LibPriority, MUIA_Disabled, FALSE);
-
- if (! clientstate) {
- set (BT_LibMore, MUIA_Disabled, FALSE);
- set (BT_LibFunctions, MUIA_Disabled, FALSE);
- }
- }
- break;
-
- case ID_DEVPRINT:
- PrintDevices (NULL);
- break;
-
- case ID_DEVICES:
- case ID_DEVUPDATE:
- DevicesWindow (TRUE);
- break;
-
- case ID_DEVREMOVE:
- if (entryp = GetActiveEntry (devlist)) {
- if (MyRequest ("Yes|No", "Do you really want to remove\n\'%ls\'?", ((struct LibEntry *) entryp)->lib_name)) {
- MyDoCommand ("RemoveDevice \"%ls\"", ((struct LibEntry *) entryp)->lib_name);
- ShowDevices ();
- }
- }
- break;
-
- case ID_DEVPRIORITY:
- if (entryp = GetActiveEntry (devlist)) {
- LONG tmppri;
-
- if (GetPriority (((struct LibEntry *) entryp)->lib_name, ((struct LibEntry *) entryp)->lib_pri, &tmppri)) {
- if (MyDoCommand ("SetPriority DEVICE \"%ls\" %ld", ((struct LibEntry *) entryp)->lib_name, tmppri)) {
- sprintf (((struct LibEntry *) entryp)->lib_pri, "%4d ", tmppri);
- }
- ShowDevices ();
- }
- }
- break;
-
- case ID_DEVFUNCTIONS:
- if (node = HandleNodeDetails (devlist, "device"))
- GetLDRFctList ((struct Library *) node,'D');
- break;
-
- case ID_DEVMORE:
- if (node = HandleNodeDetails (devlist, "device"))
- GetDevMore ((struct Library *) node);
- break;
-
- case ID_DEVEXIT:
- DevicesWindow (FALSE);
- break;
-
- case ID_DEVLV_ACTIVE:
- if (entryp = GetActiveEntry (devlist)) {
- MySetContents (devtext, "%ls \"%ls\"", ((struct LibEntry *) entryp)->lib_address, ((struct LibEntry *) entryp)->lib_name);
-
- set (BT_DevRemove, MUIA_Disabled, FALSE);
- set (BT_DevPriority, MUIA_Disabled, FALSE);
-
- if (! clientstate) {
- set (BT_DevMore, MUIA_Disabled, FALSE);
- set (BT_DevFunctions, MUIA_Disabled, FALSE);
- }
- }
- break;
-
- case ID_RESPRINT:
- PrintResources (NULL);
- break;
-
- case ID_RESOURCES:
- case ID_RESUPDATE:
- ResourcesWindow (TRUE);
- break;
-
- case ID_RESREMOVE:
- if (entryp = GetActiveEntry (reslist)) {
- if (MyRequest ("Yes|No", "Do you really want to remove\n\'%ls\'?", ((struct LibEntry *) entryp)->lib_name)) {
- MyDoCommand ("RemoveResource \"%ls\"", ((struct LibEntry *) entryp)->lib_name);
- ShowResources ();
- }
- }
- break;
-
- case ID_RESPRIORITY:
- if (entryp = GetActiveEntry (reslist)) {
- LONG tmppri;
-
- if (GetPriority (((struct LibEntry *) entryp)->lib_name, ((struct LibEntry *) entryp)->lib_pri, &tmppri)) {
- if (MyDoCommand ("SetPriority RESOURCE \"%ls\" %ld", ((struct LibEntry *) entryp)->lib_name, tmppri)) {
- sprintf (((struct LibEntry *) entryp)->lib_pri, "%4d ", tmppri);
- }
- ShowResources ();
- }
- }
- break;
-
- case ID_RESFUNCTIONS:
- if (node = HandleNodeDetails (reslist, "resource"))
- GetLDRFctList ((struct Library *) node,'R');
- break;
-
- case ID_RESMORE:
- if (node = HandleNodeDetails (reslist, "resource"))
- GetResMore ((struct Library *) node);
- break;
-
- case ID_RESEXIT:
- ResourcesWindow (FALSE);
- break;
-
- case ID_RESLV_ACTIVE:
- if (entryp = GetActiveEntry (reslist)) {
- MySetContents (restext, "%ls \"%ls\"", ((struct LibEntry *) entryp)->lib_address, ((struct LibEntry *) entryp)->lib_name);
-
- set (BT_ResRemove, MUIA_Disabled, FALSE);
- set (BT_ResPriority, MUIA_Disabled, FALSE);
-
- if (! clientstate) {
- set (BT_ResMore, MUIA_Disabled, FALSE);
- set (BT_ResFunctions, MUIA_Disabled, FALSE);
- }
- }
- break;
-
- case ID_TASKPRINT:
- PrintTasks (NULL);
- break;
-
- case ID_TASKS:
- case ID_TASKUPDATE:
- TasksWindow (TRUE);
- break;
-
- case ID_CPUUSAGE:
- if (! clientstate) {
- CheckCPUUsage();
- }
- break;
-
- case ID_TASKREMOVE:
- if (entryp = GetActiveEntry (tasklist)) {
- if (MyRequest ("Yes|No", "Do you really want to remove\ntask \'%ls\'?", ((struct TaskEntry *) entryp)->ts_name)) {
- if (MyDoCommand ("RemoveTask %ls", ((struct TaskEntry *) entryp)->ts_address)) {
- RemoveActiveEntry (tasklist);
- SetCountText (taskcount, --taskcnt);
- } else {
- ShowTasks();
- }
- }
- }
- break;
-
- case ID_TASKFREEZE:
- if (entryp = GetActiveEntry (tasklist)) {
- if (MyDoCommand ("FreezeTask %ls", ((struct TaskEntry *) entryp)->ts_address)) {
- strcpy (((struct TaskEntry *) entryp)->ts_state, "frozen");
- RedrawActiveEntry (tasklist);
- } else {
- ShowTasks();
- }
- }
- break;
-
- case ID_TASKACTIVATE:
- if (entryp = GetActiveEntry (tasklist)) {
- if (MyDoCommand ("ActivateTask %ls", ((struct TaskEntry *) entryp)->ts_address)) {
- strcpy (((struct TaskEntry *) entryp)->ts_state, "wait");
- RedrawActiveEntry (tasklist);
- } else {
- ShowTasks();
- }
- }
- break;
-
- case ID_TASKSIGNAL:
- if (entryp = GetActiveEntry (tasklist)) {
- char tmptext[12];
-
- if (GetSignal (((struct TaskEntry *) entryp)->ts_name, ((struct TaskEntry *) entryp)->ts_sigwait, tmptext)) {
- if (MyDoCommand ("SignalTask %ls %ls", ((struct TaskEntry *) entryp)->ts_address, tmptext)) {
- Delay (25);
- RedrawActiveEntry (tasklist);
- } else {
- ShowTasks();
- }
- }
- }
- break;
-
- case ID_TASKBREAK:
- if (entryp = GetActiveEntry (tasklist)) {
- if (MyDoCommand ("BreakTask %ls", ((struct TaskEntry *) entryp)->ts_address)) {
- Delay (25);
- RedrawActiveEntry (tasklist);
- } else {
- ShowTasks();
- }
- }
- break;
-
- case ID_TASKPRIORITY:
- if (entryp = GetActiveEntry (tasklist)) {
- long tmppri = 0;
-
- if (GetPriority (((struct TaskEntry *) entryp)->ts_name, ((struct TaskEntry *) entryp)->ts_pri, &tmppri)) {
- if (MyDoCommand ("SetTaskPri %ls %ld", ((struct TaskEntry *) entryp)->ts_address, tmppri)) {
- sprintf (((struct TaskEntry *) entryp)->ts_pri, "%4d ", tmppri);
- RedrawActiveEntry (tasklist);
- } else {
- ShowTasks();
- }
- }
- }
- break;
-
- case ID_TASKMORE:
- if (entryp = GetActiveEntry (tasklist)) {
- Forbid();
- if (tmptask = MyFindTask (((struct TaskEntry *) entryp)->ts_address)) {
- if (((struct Node *) tmptask)->ln_Type == NT_PROCESS) {
- GetProcessMore ((struct Process *) tmptask);
- } else {
- GetTaskMore ((struct Task *) tmptask);
- }
- Permit();
- } else {
- Permit();
- MyRequest ("Continue", "Sorry, can't find that %ls!", "task");
- ShowTasks();
- }
- }
- break;
-
- case ID_TASKEXIT:
- TasksWindow (FALSE);
- break;
-
- case ID_TASKLV_ACTIVE:
- if (entryp = GetActiveEntry (tasklist)) {
- MySetContentsHealed (tasktext, "%ls \"%ls\"", ((struct TaskEntry *) entryp)->ts_address, ((struct TaskEntry *) entryp)->ts_name);
- set (BT_TaskRemove, MUIA_Disabled, FALSE);
- set (BT_TaskFreeze, MUIA_Disabled, FALSE);
- set (BT_TaskActivate, MUIA_Disabled, FALSE);
- set (BT_TaskPriority, MUIA_Disabled, FALSE);
- set (BT_TaskSignal, MUIA_Disabled, FALSE);
- set (BT_TaskBreak, MUIA_Disabled, FALSE);
-
- if (! clientstate) {
- set (BT_TaskMore, MUIA_Disabled, FALSE);
- }
- }
- break;
-
- case ID_CXPRINT:
- PrintCx (NULL);
- break;
-
- case ID_COMMODITIES:
- case ID_CXUPDATE:
- CxWindow (TRUE);
- break;
-
- case ID_CXREMOVE:
- if (entryp = GetActiveEntry (cxlist)) {
- if (MyRequest ("Yes|No", "Do you really want to remove\ncommodity \'%ls\'?", ((struct CxEntry *) entryp)->cxe_name)) {
- if (MyDoCommand ("RemoveCx %ls", ((struct CxEntry *) entryp)->cxe_address)) {
- RemoveActiveEntry (cxlist);
- SetCountText (cxcount, --cxcnt);
- } else {
- ShowCx();
- }
- }
- }
- break;
-
- case ID_CXPRIORITY:
- if (entryp = GetActiveEntry (cxlist)) {
- long tmppri = 0;
-
- if (GetPriority (((struct CxEntry *) entryp)->cxe_name, ((struct CxEntry *) entryp)->cxe_pri, &tmppri)) {
- if (MyDoCommand ("SetCxPri %ls %ld", ((struct CxEntry *) entryp)->cxe_address, tmppri)) {
- sprintf (((struct CxEntry *) entryp)->cxe_pri, "%4d ", tmppri);
- RedrawActiveEntry (cxlist);
- } else {
- ShowCx();
- }
- }
- }
- break;
-
- case ID_CXMORE:
- if (entryp = GetActiveEntry (cxlist))
- GetCxMore((struct MyCxObj *) ((struct CxEntry *)entryp)->cxe_adr);
- break;
-
- case ID_CXEXIT:
- CxWindow (FALSE);
- break;
-
- case ID_CXAPPEAR:
- cxhelp = "Appear";
- goto cx_setup;
- case ID_CXDISAPPEAR:
- cxhelp = "Disappear";
- goto cx_setup;
- case ID_CXENABLE:
- cxhelp = "Enable";
- goto cx_setup;
- case ID_CXDISABLE:
- cxhelp = "Disable";
- goto cx_setup;
- case ID_CXKILL:
- cxhelp = "Kill";
- goto cx_setup;
- case ID_CXLISTCHG:
- cxhelp = "ListChg";
- goto cx_setup;
- case ID_CXUNIQUE:
- cxhelp = "Unique";
- cx_setup:
- if (entryp = GetActiveEntry (cxlist)) {
- MyDoCommand ("Cx%ls \"%ls\"", cxhelp, ((struct CxEntry *) entryp)->cxe_name);
- Delay(20);
- CxWindow (TRUE);
- }
- break;
-
- case ID_CXLV_ACTIVE:
- if (entryp = GetActiveEntry (cxlist)) {
- MySetContentsHealed (cxtext, "%ls \"%ls\"", ((struct CxEntry *) entryp)->cxe_address, ((struct CxEntry *) entryp)->cxe_name);
-
- set (BT_CxAppear, MUIA_Disabled, FALSE);
- set (BT_CxDisappear, MUIA_Disabled, FALSE);
- set (BT_CxEnable, MUIA_Disabled, FALSE);
- set (BT_CxDisable, MUIA_Disabled, FALSE);
- set (BT_CxKill, MUIA_Disabled, FALSE);
- set (BT_CxListChg, MUIA_Disabled, FALSE);
- set (BT_CxUnique, MUIA_Disabled, FALSE);
- set (BT_CxPriority, MUIA_Disabled, FALSE);
- set (BT_CxRemove, MUIA_Disabled, FALSE);
- if (! clientstate) {
- set (BT_CxMore, MUIA_Disabled, FALSE);
- }
- }
- break;
-
- case ID_CLASSPRINT:
- PrintClass (NULL);
- break;
-
- case ID_CLASSES:
- case ID_CLASSUPDATE:
- ClassWindow (TRUE);
- break;
-
- case ID_CLASSREMOVE:
- if (entryp = GetActiveEntry (classlist)) {
- if (MyRequest ("Yes|No", "Do you really want to remove\nclass \'%ls\'?", ((struct ClassEntry *) entryp)->cse_classname)) {
- if (MyDoCommand ("RemoveClass %ls", ((struct ClassEntry *) entryp)->cse_address)) {
- RemoveActiveEntry (classlist);
- SetCountText (classcount, --classcnt);
- } else {
- ShowClass();
- }
- }
- }
- break;
-
- case ID_CLASSMORE:
- if (entryp = GetActiveEntry (classlist))
- GetClassMore((struct IClass *) ((struct ClassEntry *)entryp)->cse_adr);
- break;
-
- case ID_CLASSEXIT:
- ClassWindow (FALSE);
- break;
-
- case ID_CLASSLV_ACTIVE:
- if (entryp = GetActiveEntry (classlist)) {
- MySetContentsHealed (classtext, "%ls \"%ls\"", ((struct ClassEntry *) entryp)->cse_address, ((struct ClassEntry *) entryp)->cse_classname);
-
- set (BT_ClassRemove, MUIA_Disabled, FALSE);
- if (! clientstate) {
- set (BT_ClassMore, MUIA_Disabled, FALSE);
- }
- }
- break;
-
- case ID_SMODEPRINT:
- PrintSMode (NULL);
- break;
-
- case ID_SCREENMODE:
- case ID_SMODEUPDATE:
- SModeWindow (TRUE);
- break;
-
- case ID_SMODEMORE:
- if (entryp = GetActiveEntry (smodelist))
- GetSModeMore((struct SModeEntry *)entryp);
- break;
-
- case ID_SMODEEXIT:
- SModeWindow (FALSE);
- break;
-
- case ID_SMODELV_ACTIVE:
- if (entryp = GetActiveEntry (smodelist)) {
- MySetContentsHealed (smodetext, "%ls \"%ls\"", ((struct SModeEntry *) entryp)->sme_id, ((struct SModeEntry *) entryp)->sme_name);
- if (! clientstate) {
- set (BT_SModeMore, MUIA_Disabled, FALSE);
- }
- }
- break;
-
- case ID_LOCKPRINT:
- PrintLocks (NULL);
- break;
-
- case ID_LOCKS:
- case ID_LOCKUPDATE:
- LocksWindow (TRUE);
- break;
-
- case ID_LOCKREMOVE:
- {
- int tmpint = 1;
- id = -1;
- pos = -42;
-
- for (;;) {
- DoMethod (locklist,MUIM_List_NextSelected,&id);
- if ((id == -1) || (tmpint == 0)) break;
- DoMethod (locklist,MUIM_List_GetEntry,id,&entryp);
- if (entryp) {
- if (tmpint != 2) { // ungleich ALL
- tmpint = MyRequest ("Yes|All|No|Abort", "Do you really want to remove lock\n\'%ls\'?", ((struct LockEntry *) entryp)->lock_path);
- }
- get (locklist,MUIA_List_Active,&pos);
- if (pos == id) {
- set (locklist,MUIA_List_Active,MUIV_List_Active_Off);
- }
- if ((tmpint == 1) || (tmpint == 2)) { // YES oder ALL
- if (MyDoCommand ("RemoveLock %ls", ((struct LockEntry *) entryp)->lock_address)) {
- DoMethod (locklist, MUIM_List_Remove, id);
- id -= 1;
- }
- } else if (tmpint == 3) {
- DoMethod (locklist,MUIM_List_Select,id,MUIV_List_Select_Off,NULL);
- }
- }
- }
- }
- break;
-
- case ID_LOCKEXIT:
- LocksWindow (FALSE);
- break;
-
- case ID_LOCKLV_ACTIVE:
- if (entryp = GetActiveEntry (locklist)) {
- MySetContents (locktext, "%ls \"%ls\"", ((struct LockEntry *) entryp)->lock_address, ((struct LockEntry *) entryp)->lock_path);
- set (BT_LockRemove, MUIA_Disabled, FALSE);
- }
- break;
-
- case ID_PORTPRINT:
- PrintPorts (NULL);
- break;
-
- case ID_PORTS:
- case ID_PORTUPDATE:
- PortsWindow (TRUE);
- break;
-
- case ID_PORTREMOVE:
- if (entryp = GetActiveEntry (portlist)) {
- if (MyRequest ("Yes|No", "Do you really want to remove port\n\'%ls\'?", ((struct PortEntry *) entryp)->pt_name)) {
- if (MyDoCommand ("RemovePort %ls", ((struct PortEntry *) entryp)->pt_address)) {
- RemoveActiveEntry (portlist);
- SetCountText (portcount, --portcnt);
- } else {
- ShowPorts();
- }
- }
- }
- break;
-
- case ID_PORTPRIORITY:
- if (entryp = GetActiveEntry (portlist)) {
- LONG tmppri;
-
- if (GetPriority (((struct PortEntry *) entryp)->pt_name, ((struct PortEntry *) entryp)->pt_pri, &tmppri)) {
- if (MyDoCommand ("SetPriority PORT \"%ls\" %ld", ((struct PortEntry *) entryp)->pt_name, tmppri)) {
- sprintf (((struct PortEntry *) entryp)->pt_pri, "%4d ", tmppri);
- }
- ShowPorts();
- }
- }
- break;
-
- case ID_PORTMORE:
- if (node = HandleNodeDetails (portlist, "port"))
- GetPortMore ((struct MsgPort *) node);
- break;
-
- case ID_PORTEXIT:
- PortsWindow (FALSE);
- break;
-
- case ID_PORTLV_ACTIVE:
- if (entryp = GetActiveEntry (portlist)) {
- MySetContents (porttext, "%ls \"%ls\"", ((struct PortEntry *) entryp)->pt_address, ((struct PortEntry *) entryp)->pt_name);
- set (BT_PortRemove, MUIA_Disabled, FALSE);
- set (BT_PortPriority, MUIA_Disabled, FALSE);
-
- if (! clientstate) {
- set (BT_PortMore, MUIA_Disabled, FALSE);
- }
- }
- break;
-
- case ID_MEMPRINT:
- PrintMemory (NULL);
- break;
-
- case ID_MEMORY:
- MemoryWindow (TRUE);
- break;
-
- case ID_MEMPRIORITY:
- if (entryp = GetActiveEntry (memlist)) {
- LONG tmppri;
-
- if (GetPriority (((struct MemoEntry *) entryp)->mem_name, ((struct MemoEntry *) entryp)->mem_pri, &tmppri)) {
- if (MyDoCommand ("SetPriority MEMORY \"%ls\" %ld", ((struct MemoEntry *) entryp)->mem_name, tmppri)) {
- sprintf (((struct MemoEntry *) entryp)->mem_pri, "%4d ", tmppri);
- }
- ShowMemory();
- }
- }
- break;
-
- case ID_MEMMORE:
- if (node = HandleNodeDetails (memlist, "memory"))
- GetMemMore ((struct MemHeader *) node);
- break;
-
- case ID_MEMEXIT:
- MemoryWindow (FALSE);
- break;
-
- case ID_MEMLV_ACTIVE:
- if (entryp = GetActiveEntry (memlist)) {
- MySetContents (memtext, "%ls \"%ls\"", ((struct MemoEntry *) entryp)->mem_address, ((struct MemoEntry *) entryp)->mem_name);
-
- set (BT_MemPriority, MUIA_Disabled, FALSE);
-
- if (! clientstate) {
- set (BT_MemMore, MUIA_Disabled, FALSE);
- }
- }
- break;
-
- case ID_MOUNTPRINT:
- PrintMounts (NULL);
- break;
-
- case ID_MOUNT:
- case ID_MOUNTUPDATE:
- MountWindow (TRUE);
- break;
-
- case ID_MOUNTMORE:
- if (entryp = GetActiveEntry (mountlist)) {
- GetMountMore ((struct DeviceNode *) ((struct MountEntry *) entryp)->mt_adr);
- }
- break;
-
- case ID_MOUNTEXIT:
- MountWindow (FALSE);
- break;
-
- case ID_MOUNTLV_ACTIVE:
- if (entryp = GetActiveEntry (mountlist)) {
- MySetContents (mounttext, "%ls \"%ls\"", ((struct MountEntry *) entryp)->mt_address, ((struct MountEntry *) entryp)->mt_name);
-
- if (! clientstate) {
- set (BT_MountMore, MUIA_Disabled, FALSE);
- }
- }
- break;
-
- case ID_COMPRINT:
- PrintCommands (NULL);
- break;
-
- case ID_COMMANDS:
- case ID_COMUPDATE:
- CommandsWindow (TRUE);
- break;
-
- case ID_COMREMOVE:
- if ((((struct CommandEntry *) entryp)->cm_adr != NULL) && (entryp = GetActiveEntry (comlist))) {
- int tmpint;
-
- if (((struct CommandEntry *) entryp)->cm_uc[0] == 'I') {
- MyRequest ("Continue", "Can not remove INTERNAL commands!");
- } else if (((struct CommandEntry *) entryp)->cm_uc[0] == 'S') {
- MyRequest ("Continue", "Can not remove SYSTEM commands!");
- } else if (((struct CommandEntry *) entryp)->cm_uc[0] == 'D') {
- MyRequest ("Continue", "Can not remove DISABLED commands!");
- } else {
- if (MyRequest ("Yes|No", "Do you really want to remove command\n\'%ls\'?", ((struct CommandEntry *) entryp)->cm_name)) {
- if (MyDoCommand ("RemoveCommand %ls", ((struct CommandEntry *) entryp)->cm_address)) {
- SetCountText (comcount, --comcnt);
- RemoveActiveEntry (comlist);
- for (tmpint=0;;tmpint++) {
- if ((entryp = GetActiveEntry (comlist)) && (((struct CommandEntry *) entryp)->cm_address[0] == ' ')) {
- RemoveActiveEntry (comlist);
- } else {
- break;
- }
- }
- }
- }
- }
- }
- break;
-
- case ID_COMEXIT:
- CommandsWindow (FALSE);
- break;
-
- case ID_COMLV_ACTIVE:
- if (entryp = GetActiveEntry (comlist)) {
- if (((struct CommandEntry *) entryp)->cm_adr == NULL) {
- MySetContents (comtext, (char *) NULL);
- } else {
- MySetContents (comtext, "%ls \"%ls\"", ((struct CommandEntry *) entryp)->cm_address, ((struct CommandEntry *) entryp)->cm_name);
- }
- set (BT_ComRemove, MUIA_Disabled, FALSE);
- }
- break;
-
- case ID_INTPRINT:
- PrintInterrupts (NULL);
- break;
-
- case ID_INTERRUPTS:
- case ID_INTUPDATE:
- InterruptsWindow (TRUE);
- break;
-
- case ID_INTREMOVE:
- if (entryp = GetActiveEntry (intlist)) {
- if (((struct IntEntry *) entryp)->int_kind[0] == 'H') {
- MyRequest ("Resume", "Sorry, I can't remove an\ninterrupt handler!");
- } else {
- if (MyRequest ("Yes|No", "Do you really want to remove\n\'%ls\'?", ((struct IntEntry *) entryp)->int_name)) {
- MyDoCommand ("RemoveInterrupt \"%ls\"", ((struct IntEntry *) entryp)->int_name);
- ShowInterrupts();
- }
- }
- }
- break;
-
- case ID_INTMORE:
- if (entryp = GetActiveEntry (intlist)) {
- GetIntMore ((struct IntEntry *) entryp);
- }
- break;
-
- case ID_INTEXIT:
- InterruptsWindow (FALSE);
- break;
-
- case ID_INTLV_ACTIVE:
- if (entryp = GetActiveEntry (intlist)) {
- MySetContents (inttext, "%ls \"%ls\"", ((struct IntEntry *) entryp)->int_address, ((struct IntEntry *) entryp)->int_name);
- set (BT_IntRemove, MUIA_Disabled, FALSE);
-
- if (! clientstate) {
- set (BT_IntMore, MUIA_Disabled, FALSE);
- }
- }
- break;
-
- case ID_SEMPRINT:
- PrintSemaphores (NULL);
- break;
-
- case ID_SEMAPHORES:
- case ID_SEMUPDATE:
- SemaphoresWindow (TRUE);
- break;
-
- case ID_SEMOBTAIN:
- if (entryp = GetActiveEntry (semlist)) {
- if (MyRequest ("Yes|No", "Do you really want to obtain semaphore\n\'%ls\'?", ((struct SemEntry *) entryp)->sm_name)) {
- if (MyDoCommand ("ObtainSemaphore %ls", ((struct SemEntry *) entryp)->sm_address)) {
- ShowSemaphores();
- } else {
- ShowSemaphores();
- }
- }
- }
- break;
-
- case ID_SEMRELEASE:
- if (entryp = GetActiveEntry (semlist)) {
- long tmplong;
-
- if ((IsDec (((struct SemEntry *) entryp)->sm_nestcount, &tmplong)) && (tmplong)) {
- if (MyRequest ("Yes|No", "Do you really want to release semaphore\n\'%ls\'?", ((struct SemEntry *) entryp)->sm_name)) {
- MyDoCommand ("ReleaseSemaphore %ls", ((struct SemEntry *) entryp)->sm_address);
- ShowSemaphores();
- }
- } else {
- MyRequest ("Continue", "Sorry, the nestcount is already zero!");
- }
- }
- break;
-
- case ID_SEMREMOVE:
- if (entryp = GetActiveEntry (semlist)) {
- long tmplong;
-
- if ((IsDec (((struct SemEntry *) entryp)->sm_nestcount, &tmplong)) && (tmplong)) {
- MyRequest ("Continue", "Sorry, the nestcount is not zero!");
- } else {
- if (MyRequest ("Yes|No", "Do you really want to remove semaphore\n\'%ls\'?", ((struct SemEntry *) entryp)->sm_name)) {
- MyDoCommand ("RemoveSemaphore %ls", ((struct SemEntry *) entryp)->sm_address);
- ShowSemaphores();
- }
- }
- }
- break;
-
- case ID_SEMEXIT:
- SemaphoresWindow (FALSE);
- break;
-
- case ID_SEMLV_ACTIVE:
- if (entryp = GetActiveEntry (semlist)) {
- MySetContents (semtext, "%ls \"%ls\"", ((struct SemEntry *) entryp)->sm_address, ((struct SemEntry *) entryp)->sm_name);
- set (BT_SemObtain, MUIA_Disabled, FALSE);
- set (BT_SemRelease, MUIA_Disabled, FALSE);
- set (BT_SemRemove, MUIA_Disabled, FALSE);
- }
- break;
-
- case ID_INPUTPRINT:
- PrintInputHandlers (NULL);
- break;
-
- case ID_INPUTHANDLER:
- case ID_INPUTUPDATE:
- InputHandlerWindow (TRUE);
- break;
-
- case ID_INPUTREMOVE:
- if (entryp = GetActiveEntry (inputlist)) {
- if (MyRequest ("Yes|No", "Do you really want to remove\n\'%ls\'?", ((struct InputEntry *) entryp)->input_name)) {
- if (MyDoCommand ("RemoveInputhandler %ls", ((struct InputEntry *) entryp)->input_address)) {
- SetCountText (inputcount, --inputcnt);
- RemoveActiveEntry (inputlist);
- } else {
- ShowInputHandler();
- }
- }
- }
- break;
-
- case ID_INPUTPRIORITY:
- if (entryp = GetActiveEntry (inputlist)) {
- LONG tmppri;
-
- if (GetPriority (((struct InputEntry *) entryp)->input_name, ((struct InputEntry *) entryp)->input_pri, &tmppri)) {
- if (MyDoCommand ("SetPriority INPUTHANDLER \"%ls\" %ld", ((struct InputEntry *) entryp)->input_name, tmppri)) {
- sprintf (((struct InputEntry *) entryp)->input_pri, "%4d ", tmppri);
- }
- ShowInputHandler();
- }
- }
- break;
-
- case ID_INPUTEXIT:
- InputHandlerWindow (FALSE);
- break;
-
- case ID_INPUTLV_ACTIVE:
- if (entryp = GetActiveEntry (inputlist)) {
- MySetContents (inputtext, "%ls \"%ls\"", ((struct InputEntry *) entryp)->input_address, ((struct InputEntry *) entryp)->input_name);
- set (BT_InputRemove, MUIA_Disabled, FALSE);
- set (BT_InputPriority, MUIA_Disabled, FALSE);
- }
- break;
-
- case ID_EXPPRINT:
- PrintExpansions (NULL);
- break;
-
- case ID_EXPANSIONS:
- ExpansionsWindow (TRUE);
- break;
-
- case ID_EXPMORE:
- if (entryp = GetActiveEntry (explist)) {
- GetExpansionMore ((struct ConfigDev *) ((struct ExpEntry *) entryp)->exp_adr);
- }
- break;
-
- case ID_EXPEXIT:
- ExpansionsWindow (FALSE);
- break;
-
- case ID_EXPLV_ACTIVE:
- if (entryp = GetActiveEntry (explist)) {
- sprintf(tmpstr,"Size=%s Flags=%s ID=%s:%s SN=%s",
- ((struct ExpEntry *)entryp)->exp_boardsize,
- ((struct ExpEntry *)entryp)->exp_flags,
- ((struct ExpEntry *)entryp)->exp_manufacturer,
- ((struct ExpEntry *)entryp)->exp_product,
- ((struct ExpEntry *)entryp)->exp_serialnumber);
- set (exptext,MUIA_Text_Contents,tmpstr);
-
- if (!clientstate) {
- set (BT_ExpMore, MUIA_Disabled, FALSE);
- }
- }
- break;
-
- case ID_RESIPRINT:
- PrintResidents (NULL);
- break;
-
- case ID_RESIDENTS:
- case ID_RESIUPDATE:
- ResidentsWindow (TRUE);
- break;
-
- case ID_RESIMORE:
- if (entryp = GetActiveEntry (resilist)) {
- GetResiMore (((struct ResiEntry *) entryp)->rt_adr);
- }
- break;
-
- case ID_RESIEXIT:
- ResidentsWindow (FALSE);
- break;
-
- case ID_RESILV_ACTIVE:
- if (entryp = GetActiveEntry (resilist)) {
- MySetContentsHealed (resitext, "%ls \"%ls\"", ((struct ResiEntry *) entryp)->rt_address, ((struct ResiEntry *) entryp)->rt_name);
-
- if (! clientstate) {
- set (BT_ResiMore, MUIA_Disabled, FALSE);
- }
- }
- break;
-
- case ID_WINPRINT:
- PrintWindows (NULL);
- break;
-
- case ID_WINDOWS:
- case ID_WINUPDATE:
- WindowsWindow (TRUE);
- break;
-
- case ID_WINCLOSE:
- if (entryp = GetActiveEntry (winlist)) {
- if (((struct WinEntry *) entryp)->wn_type == 'S') {
- if ((! clientstate) && (((struct Screen *) ((struct WinEntry *) entryp)->wn_adr)->FirstWindow)) {
- if (MyRequest ("Yes|No", "Do you really want to close this\n%ls?", "screen with all its windows")) {
- MyDoCommand ("CloseScreen %ls", ((struct WinEntry *) entryp)->wn_address + 2);
- ShowWindows();
- }
- } else {
- if (MyRequest ("Yes|No", "Do you really want to close this\n%ls?", "screen")) {
- MyDoCommand ("CloseScreen %ls", ((struct WinEntry *) entryp)->wn_address + 2);
- ShowWindows();
- }
- }
- } else {
- if (MyRequest ("Yes|No", "Do you really want to close this\n%ls?", "window")) {
- MyDoCommand ("CloseWindow %ls", ((struct WinEntry *) entryp)->wn_address);
- ShowWindows();
- }
- }
- }
- break;
-
- case ID_WINTOFRONT:
- if (entryp = GetActiveEntry (winlist)) {
- if (((struct WinEntry *) entryp)->wn_type == 'S') {
- MyDoCommand ("PopToFront %ls", ((struct WinEntry *) entryp)->wn_address + 2);
- } else {
- MyDoCommand ("PopToFront %ls", ((struct WinEntry *) entryp)->wn_address);
- }
- }
- break;
-
- case ID_WINMORE:
- if (entryp = GetActiveEntry (winlist)) {
- if (((struct WinEntry *) entryp)->wn_type == 'W') {
- struct Window *tmpwindow;
-
- if (tmpwindow = MyFindWindow (((struct WinEntry *) entryp)->wn_address))
- GetWindowMore (tmpwindow);
- else
- MyRequest ("Continue", "Sorry, can't find that %ls!", "window");
- } else {
- struct Screen *tmpscreen;
-
- if (tmpscreen = MyFindScreen (((struct WinEntry *) entryp)->wn_address + 2))
- GetScreenMore (tmpscreen);
- else
- MyRequest ("Continue", "Sorry, can't find that %ls!", "screen");
- }
- }
- break;
-
- case ID_WINEXIT:
- WindowsWindow (FALSE);
- break;
-
- case ID_WINLV_ACTIVE:
- if (entryp = GetActiveEntry (winlist)) {
- if (((struct WinEntry *) entryp)->wn_type == 'S') {
- MySetContentsHealed (wintext, "%ls \"%ls\"", ((struct WinEntry *) entryp)->wn_address, ((struct WinEntry *) entryp)->wn_title);
- } else {
- MySetContentsHealed (wintext, "%ls \"%ls\"", ((struct WinEntry *) entryp)->wn_address, ((struct WinEntry *) entryp)->wn_title);
- }
- set (BT_WinClose, MUIA_Disabled, FALSE);
- set (BT_WinToFront, MUIA_Disabled, FALSE);
-
- if (! clientstate) {
- set (BT_WinMore, MUIA_Disabled, FALSE);
- }
- }
- break;
-
- case ID_ALCPRINT:
- PrintAllocations (NULL);
- break;
-
- case ID_ALLOCATIONS:
- case ID_ALCUPDATE:
- AllocationsWindow (TRUE);
- break;
-
- case ID_ALCEXIT:
- AllocationsWindow (FALSE);
- break;
-
- case ID_ASSPRINT:
- PrintAssigns (NULL);
- break;
-
- case ID_ASSIGNS:
- case ID_ASSUPDATE:
- AssignsWindow (TRUE);
- break;
-
- case ID_ASSREMOVE:
- if (entryp = GetActiveEntry (asslist)) {
- if (((struct AssEntry *) entryp)->ass_path[0] == ' ') {
- if (MyRequest ("Yes|No", "Do you really want to remove directory\n\'%ls\' from assign '%ls:\'?", ((struct AssEntry *) entryp)->ass_path +4, ((struct AssEntry *) entryp)->ass_name)) {
- if (MyDoCommand ("RemoveAssignList %ls $%lx", ((struct AssEntry *) entryp)->ass_name, ((struct AssEntry *) entryp)->ass_adr)) {
- SetCountText (asscount, --asscnt);
- RemoveActiveEntry (asslist);
- } else {
- ShowAssigns();
- }
- }
- } else {
- if (MyRequest ("Yes|No", "Do you really want to remove assign\n\'%ls:\'?", ((struct AssEntry *) entryp)->ass_name)) {
- if (MyDoCommand ("RemoveAssign %ls", ((struct AssEntry *) entryp)->ass_name)) {
- SetCountText (asscount, --asscnt);
- RemoveActiveEntry (asslist);
- for (i=0;;i++) {
- if ((entryp = GetActiveEntry (asslist)) && (((struct AssEntry *) entryp)->ass_path[0] == ' ')) {
- RemoveActiveEntry (asslist);
- } else {
- break;
- }
- }
- } else {
- ShowAssigns();
- }
- }
- }
- }
- break;
-
- case ID_ASSEXIT:
- AssignsWindow (FALSE);
- break;
-
- case ID_ASSLV_ACTIVE:
- if (entryp = GetActiveEntry (asslist)) {
- if (((struct AssEntry *) entryp)->ass_path[0] != ' ') {
- MySetContents (asstext, "%ls \"%ls\"", ((struct AssEntry *) entryp)->ass_address, ((struct AssEntry *) entryp)->ass_path);
- } else {
- MySetContents (asstext, "%ls \"%ls\"", ((struct AssEntry *) entryp)->ass_address, ((struct AssEntry *) entryp)->ass_path +4);
- }
- set (BT_AssRemove, MUIA_Disabled, FALSE);
- }
- break;
-
- case ID_FONTPRINT:
- PrintFonts (NULL);
- break;
-
- case ID_FONTS:
- case ID_FONTUPDATE:
- FontsWindow (TRUE);
- break;
-
- case ID_FONTCLOSE:
- if (entryp = GetActiveEntry (fontlist)) {
- int tmpint, tmpint2;
-
- if ((IsDec (((struct FontEntry *) entryp)->font_count, (long *) &tmpint2)) && (tmpint2)) {
- if (tmpint = MyRequest ("Once|All|Cancel", "Do you really want to close\n\"%ls\"?", ((struct FontEntry *) entryp)->font_name)) {
- if (tmpint == 1) {
- MyDoCommand ("CloseFont %ls", ((struct FontEntry *) entryp)->font_address);
- } else {
- while (tmpint2) {
- if (! MyDoCommand ("CloseFont %ls", ((struct FontEntry *) entryp)->font_address)) {
- break;
- }
- tmpint2--;
- }
- }
- ShowFonts ();
- }
- } else {
- MyRequest ("Continue", "Sorry, the count of accessors is already zero!");
- }
- }
- break;
-
- case ID_FONTREMOVE:
- if (entryp = GetActiveEntry (fontlist)) {
- long tmplong;
-
- if ((IsDec (((struct FontEntry *) entryp)->font_count, &tmplong)) && (tmplong)) {
- MyRequest ("Continue", "Sorry, the count of accessors is not zero!");
- } else {
- if (MyRequest ("Yes|No", "Do you really want to remove\n\"%ls\" from system?", ((struct FontEntry *) entryp)->font_name)) {
- MyDoCommand ("RemoveFont %ls", ((struct FontEntry *) entryp)->font_address);
- ShowFonts ();
- }
- }
- }
- break;
-
- case ID_FONTEXIT:
- FontsWindow (FALSE);
- break;
-
- case ID_FONTLV_ACTIVE:
- if (entryp = GetActiveEntry (fontlist)) {
- MySetContents (fonttext, "%ls \"%ls\"", ((struct FontEntry *) entryp)->font_address, ((struct FontEntry *) entryp)->font_name);
- set (BT_FontClose, MUIA_Disabled, FALSE);
- set (BT_FontRemove, MUIA_Disabled, FALSE);
- }
- break;
-
- case ID_VECPRINT:
- PrintVectors (NULL);
- break;
-
- case ID_VECTORS:
- case ID_VECUPDATE:
- VectorsWindow (TRUE);
- break;
-
- case ID_VECEXIT:
- VectorsWindow (FALSE);
- break;
-
- case ID_SYSPRINT:
- PrintSystem (NULL);
- break;
-
- case ID_SYSTEM:
- case ID_SYSUPDATE:
- SystemWindow (TRUE);
- break;
-
- case ID_SYSEXIT:
- SystemWindow (FALSE);
- break;
-
- case ID_FLUSHDEVS:
- MyDoCommand ("FLUSHDEVS");
- break;
-
- case ID_FLUSHFONTS:
- MyDoCommand ("FLUSHFONTS");
- break;
-
- case ID_FLUSHALL:
- MyDoCommand ("FLUSHALL");
- break;
-
- case ID_FLUSHLIBS:
- MyDoCommand ("FLUSHLIBS");
- break;
-
- case ID_REMOVEWINFREE:
- if (WinFree_ToDo) {
- RemoveWinFree ();
- WinFree_ToDo = NULL;
- }
- break;
-
- case ID_FLAGWINDOW:
- if (WinFlag_ToDo) {
- GetFlagsMore (WinFlag_ToDo->wf_title2, WinFlag_ToDo->wf_fieldname, WinFlag_ToDo->wf_flags, WinFlag_ToDo->wf_longflag, WinFlag_ToDo->wf_mlongflag, WinFlag_ToDo->wf_fieldtype);
- WinFlag_ToDo = NULL;
- }
- break;
-
- case ID_CLEARRESET:
- ClearResetVectors();
- break;
-
- case ID_ABOUT:
- AboutWindow (TRUE);
- break;
-
- case ID_ABOUTCONTINUE:
- AboutWindow (FALSE);
- break;
-
- case ID_LIBSORT:
- get (CY_LibSort,MUIA_Cycle_Active,&libsortstate);
- liblist_cmphook_ptr = LibSortList[libsortstate];
- ShowLibraries();
- break;
-
- case ID_DEVSORT:
- get (CY_DevSort,MUIA_Cycle_Active,&devsortstate);
- devlist_cmphook_ptr = LibSortList[devsortstate];
- ShowDevices();
- break;
-
- case ID_RESSORT:
- get (CY_ResSort,MUIA_Cycle_Active,&ressortstate);
- reslist_cmphook_ptr = LibSortList[ressortstate];
- ShowResources();
- break;
-
- case ID_TASKSORT:
- get (CY_TaskSort,MUIA_Cycle_Active,&tasksortstate);
- tasklist_cmphook_ptr = TaskSortList[tasksortstate];
- ShowTasks();
- break;
-
- case ID_CXSORT:
- get (CY_CxSort,MUIA_Cycle_Active,&cxsortstate);
- cxlist_cmphook_ptr = CxSortList[cxsortstate];
- ShowCx();
- break;
-
- case ID_CLASSSORT:
- get (CY_ClassSort,MUIA_Cycle_Active,&classsortstate);
- classlist_cmphook_ptr = ClassSortList[classsortstate];
- ShowClass();
- break;
-
- case ID_SMODESORT:
- get (CY_SModeSort,MUIA_Cycle_Active,&smodesortstate);
- smodelist_cmphook_ptr = SModeSortList[smodesortstate];
- ShowSMode();
- break;
-
- case ID_PORTSORT:
- get (CY_PortSort,MUIA_Cycle_Active,&portsortstate);
- portlist_cmphook_ptr = PortSortList[portsortstate];
- ShowPorts();
- break;
-
- case ID_COMSORT:
- get (CY_ComSort,MUIA_Cycle_Active,&comsortstate);
- comlist_cmphook_ptr = ComSortList[comsortstate];
- ShowCommands();
- break;
-
- case ID_ASSSORT:
- get (CY_AssSort,MUIA_Cycle_Active,&asssortstate);
- asslist_cmphook_ptr = AssSortList[asssortstate];
- ShowAssigns();
- break;
-
- case ID_LOCKSORT:
- get (CY_LockSort,MUIA_Cycle_Active,&locksortstate);
- locklist_cmphook_ptr = LockSortList[locksortstate];
- ShowLocks();
- break;
-
- case ID_LOWMEMORYPRINT:
- PrintLowMemory (NULL);
- break;
-
- case ID_LOWMEMORY:
- case ID_LOWMEMORYUPDATE:
- LowMemoryWindow (TRUE);
- break;
-
- /*
- case ID_LOWMEMORYCAUSE:
- if (entryp = GetActiveEntry (lowmemorylist)) {
- MyDoCommand ("CauseLowMemory %ls", ((struct LowMemoryEntry *) entryp)->lowmemory_address);
- }
- break;
- */
-
- case ID_LOWMEMORYREMOVE:
- if (entryp = GetActiveEntry (lowmemorylist)) {
- if (MyRequest ("Yes|No", "Do you really want to remove\n\'%ls\'?", ((struct LowMemoryEntry *) entryp)->lowmemory_name)) {
- if (MyDoCommand ("RemoveLowMemory %ls", ((struct LowMemoryEntry *) entryp)->lowmemory_address)) {
- SetCountText (lowmemorycount, --lowmemorycnt);
- RemoveActiveEntry (lowmemorylist);
- } else {
- ShowLowMemory();
- }
- }
- }
- break;
-
- case ID_LOWMEMORYPRIORITY:
- if (entryp = GetActiveEntry (lowmemorylist)) {
- LONG tmppri;
-
- if (GetPriority (((struct LowMemoryEntry *) entryp)->lowmemory_name, ((struct LowMemoryEntry *) entryp)->lowmemory_pri, &tmppri)) {
- if (MyDoCommand ("SetPriority LOWMEMORY \"%ls\" %ld", ((struct LowMemoryEntry *) entryp)->lowmemory_name, tmppri)) {
- sprintf (((struct LowMemoryEntry *) entryp)->lowmemory_pri, "%4d ", tmppri);
- }
- ShowLowMemory();
- }
- }
- break;
-
- case ID_LOWMEMORYEXIT:
- LowMemoryWindow (FALSE);
- break;
-
- case ID_LOWMEMORYLV_ACTIVE:
- if (entryp = GetActiveEntry (lowmemorylist)) {
- MySetContents (lowmemorytext, "%ls \"%ls\"", ((struct LowMemoryEntry *) entryp)->lowmemory_address, ((struct LowMemoryEntry *) entryp)->lowmemory_name);
- //* set (BT_LowMemoryCause, MUIA_Disabled, FALSE);
- set (BT_LowMemoryRemove, MUIA_Disabled, FALSE);
- set (BT_LowMemoryPriority, MUIA_Disabled, FALSE);
- }
- break;
-
- case ID_TIMERPRINT:
- PrintTimer (NULL);
- break;
-
- case ID_TIMER:
- case ID_TIMERUPDATE:
- TimerWindow (TRUE);
- break;
-
- /*
- case ID_TIMERREMOVE:
- if (entryp = GetActiveEntry (timerlist)) {
- if (MyRequest ("Yes|No", "Do you really want to remove\n\'%ls\'?", ((struct TimerEntry *) entryp)->timer_name)) {
- if (MyDoCommand ("RemoveTimer %ls", ((struct TimerEntry *) entryp)->timer_address)) {
- SetCountText (timercount, --timercnt);
- RemoveActiveEntry (timerlist);
- } else {
- ShowTimer();
- }
- }
- }
- break;
- */
- case ID_TIMEREXIT:
- TimerWindow (FALSE);
- break;
-
- case ID_TIMERLV_ACTIVE:
- if (entryp = GetActiveEntry (timerlist)) {
- MySetContents (timertext, "%ls \"%ls\"", ((struct TimerEntry *) entryp)->timer_address, ((struct TimerEntry *) entryp)->timer_name);
- //* set (BT_TimerRemove, MUIA_Disabled, FALSE);
- }
- break;
-
- default:
- break;
- }
-
- if (running && signal) {
- signal = (signal | 0x0000f000 | 0x01<<TimerSignal);
- received = Wait (signal);
- }
-
- // aprintf ("\nSIGNAL: $%08lx RECEIVED: $%08lx\n", signal, received);
-
- if (0x7000 & received) {
- running = FALSE;
- aprintf ("***Break\n");
- }
-
- if (0x8000 & received)
- set (AP_Scout,MUIA_Application_Iconified,FALSE);
-
- if (0x01<<TimerSignal & received) {
- // tmpint++;
- HandleTimerRequest (TRUE);
- }
-
- signal = (signal & 0xffff0fff & 0x01<<TimerSignal);
- }
- }
-
- if (opts.Host) {
- SendDaemon (CMD_END);
- }
- fail();
- return (RETURN_OK);
- }
-
- /*********************************************************************
- END: MAIN
- *********************************************************************/
-